diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index 5e693af94fd..5350bb1bc64 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -561,10 +561,14 @@ class account_invoice(osv.osv):
def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice):
res = {}
+ if isinstance(ids, (int, long)):
+ ids = [ids]
if not date_invoice:
date_invoice = time.strftime('%Y-%m-%d')
if not payment_term_id:
- return {'value':{'date_due': date_invoice}} #To make sure the invoice has a due date when no payment term
+ inv = self.browse(cr, uid, ids[0])
+ #To make sure the invoice due date should contain due date which is entered by user when there is no payment term defined
+ return {'value':{'date_due': inv.date_due and inv.date_due or date_invoice}}
pterm_list = self.pool.get('account.payment.term').compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice)
if pterm_list:
pterm_list = [line[0] for line in pterm_list]
diff --git a/addons/account/edi/invoice.py b/addons/account/edi/invoice.py
index 91913920bac..2c2a754de3b 100644
--- a/addons/account/edi/invoice.py
+++ b/addons/account/edi/invoice.py
@@ -266,7 +266,7 @@ class account_invoice(osv.osv, EDIMixin):
params = {
"cmd": "_xclick",
"business": inv.company_id.paypal_account,
- "item_name": inv.company_id.name + " Invoice " + inv.number,
+ "item_name": "%s Invoice %s" % (inv.company_id.name, inv.number or ''),
"invoice": inv.number,
"amount": inv.residual,
"currency_code": inv.currency_id.name,
diff --git a/addons/account/wizard/account_report_aged_partner_balance_view.xml b/addons/account/wizard/account_report_aged_partner_balance_view.xml
index 77ebf02570f..be1d710c09d 100644
--- a/addons/account/wizard/account_report_aged_partner_balance_view.xml
+++ b/addons/account/wizard/account_report_aged_partner_balance_view.xml
@@ -11,7 +11,8 @@
-
+
+
diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py
index 871aea9e4d9..b8dc562f3a0 100644
--- a/addons/account/wizard/account_report_common.py
+++ b/addons/account/wizard/account_report_common.py
@@ -34,7 +34,10 @@ class account_common_report(osv.osv_memory):
res = {}
if chart_account_id:
company_id = self.pool.get('account.account').browse(cr, uid, chart_account_id, context=context).company_id.id
- res['value'] = {'company_id': company_id}
+ now = time.strftime('%Y-%m-%d')
+ domain = [('company_id', '=', company_id), ('date_start', '<', now), ('date_stop', '>', now)]
+ fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, domain, limit=1)
+ res['value'] = {'company_id': company_id, 'fiscalyear_id': fiscalyears and fiscalyears[0] or False}
return res
_columns = {
@@ -124,10 +127,11 @@ class account_common_report(osv.osv_memory):
now = time.strftime('%Y-%m-%d')
company_id = False
ids = context.get('active_ids', [])
- domain = [('date_start', '<', now), ('date_stop', '>', now)]
if ids and context.get('active_model') == 'account.account':
company_id = self.pool.get('account.account').browse(cr, uid, ids[0], context=context).company_id.id
- domain += [('company_id', '=', company_id)]
+ else: # use current company id
+ company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
+ domain = [('company_id', '=', company_id), ('date_start', '<', now), ('date_stop', '>', now)]
fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, domain, limit=1)
return fiscalyears and fiscalyears[0] or False
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 35c9163619a..0cf9ebb618e 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -1284,10 +1284,8 @@ class account_voucher(osv.osv):
}
new_id = move_line_obj.create(cr, uid, move_line_foreign_currency, context=context)
rec_ids.append(new_id)
-
if line.move_line_id.id:
rec_lst_ids.append(rec_ids)
-
return (tot_line, rec_lst_ids)
def writeoff_move_line_get(self, cr, uid, voucher_id, line_total, move_id, name, company_currency, current_currency, context=None):
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index dea94d59f4e..5d259772363 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -332,14 +332,15 @@
-
+
+ attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
+ groups="analytic.group_analytic_accounting"
+ attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
@@ -494,14 +495,15 @@
-
+
+ attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
+ groups="analytic.group_analytic_accounting"
+ attrs="{'invisible':['|', ('payment_option','!=','with_writeoff'), ('writeoff_amount','=',0)]}"/>
diff --git a/addons/auth_ldap/__openerp__.py b/addons/auth_ldap/__openerp__.py
index 844f6d9fa84..945dad5e3d2 100644
--- a/addons/auth_ldap/__openerp__.py
+++ b/addons/auth_ldap/__openerp__.py
@@ -92,11 +92,6 @@ allows pre-setting the default groups and menus of the first-time users.
user with the same login (and a blank password), then rename this new
user to a username that does not exist in LDAP, and setup its groups
the way you want.
-
-Interaction with base_crypt:
-----------------------------
-The base_crypt module is not compatible with this module, and will disable LDAP
-authentication if installed at the same time.
""",
'website' : 'http://www.openerp.com',
'category' : 'Authentication',
diff --git a/addons/auth_ldap/users_ldap.py b/addons/auth_ldap/users_ldap.py
index 8e7128ca91e..1e957a184c3 100644
--- a/addons/auth_ldap/users_ldap.py
+++ b/addons/auth_ldap/users_ldap.py
@@ -26,6 +26,7 @@ import openerp.exceptions
from openerp import tools
from openerp.osv import fields, osv
from openerp import SUPERUSER_ID
+from openerp.modules.registry import RegistryManager
_logger = logging.getLogger(__name__)
class CompanyLDAP(osv.osv):
@@ -190,9 +191,9 @@ class CompanyLDAP(osv.osv):
user_obj = self.pool['res.users']
values = self.map_ldap_attributes(cr, uid, conf, login, ldap_entry)
if conf['user']:
+ values['active'] = True
user_id = user_obj.copy(cr, SUPERUSER_ID, conf['user'],
- default={'active': True})
- user_obj.write(cr, SUPERUSER_ID, user_id, values)
+ default=values)
else:
user_id = user_obj.create(cr, SUPERUSER_ID, values)
return user_id
@@ -243,41 +244,31 @@ class users(osv.osv):
user_id = super(users, self).login(db, login, password)
if user_id:
return user_id
- cr = self.pool.db.cursor()
- ldap_obj = self.pool['res.company.ldap']
- for conf in ldap_obj.get_ldap_dicts(cr):
- entry = ldap_obj.authenticate(conf, login, password)
- if entry:
- user_id = ldap_obj.get_or_create_user(
- cr, SUPERUSER_ID, conf, login, entry)
- if user_id:
- cr.execute("""UPDATE res_users
- SET login_date=now() AT TIME ZONE 'UTC'
- WHERE login=%s""",
- (tools.ustr(login),))
- cr.commit()
- break
- cr.close()
- return user_id
-
- def check(self, db, uid, passwd):
- try:
- return super(users,self).check(db, uid, passwd)
- except openerp.exceptions.AccessDenied:
- pass
-
- cr = self.pool.db.cursor()
- cr.execute('SELECT login FROM res_users WHERE id=%s AND active=TRUE',
- (int(uid),))
- res = cr.fetchone()
- if res:
- ldap_obj = self.pool['res.company.ldap']
+ registry = RegistryManager.get(db)
+ with registry.cursor() as cr:
+ ldap_obj = registry.get('res.company.ldap')
for conf in ldap_obj.get_ldap_dicts(cr):
- if ldap_obj.authenticate(conf, res[0], passwd):
- self._uid_cache.setdefault(db, {})[uid] = passwd
- cr.close()
- return True
- cr.close()
- raise openerp.exceptions.AccessDenied()
+ entry = ldap_obj.authenticate(conf, login, password)
+ if entry:
+ user_id = ldap_obj.get_or_create_user(
+ cr, SUPERUSER_ID, conf, login, entry)
+ if user_id:
+ break
+ return user_id
+
+ def check_credentials(self, cr, uid, password):
+ try:
+ super(users, self).check_credentials(cr, uid, password)
+ except openerp.exceptions.AccessDenied:
+
+ cr.execute('SELECT login FROM res_users WHERE id=%s AND active=TRUE',
+ (int(uid),))
+ res = cr.fetchone()
+ if res:
+ ldap_obj = self.pool['res.company.ldap']
+ for conf in ldap_obj.get_ldap_dicts(cr):
+ if ldap_obj.authenticate(conf, res[0], password):
+ return
+ raise
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index a9061c0afce..64b6f01d05c 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -1187,8 +1187,8 @@ rule or repeating pattern of time to exclude from the recurring rule."),
context = {}
result = []
- for data in super(calendar_event, self).read(cr, uid, select, ['rrule', 'exdate', 'exrule', 'date'], context=context):
- if not data['rrule']:
+ for data in super(calendar_event, self).read(cr, uid, select, ['rrule', 'recurrency', 'exdate', 'exrule', 'date'], context=context):
+ if not data['recurrency'] or not data['rrule']:
result.append(data['id'])
continue
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
diff --git a/addons/document/document.py b/addons/document/document.py
index 54f12e204fe..91af97246b8 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -68,11 +68,14 @@ class document_file(osv.osv):
]
def check(self, cr, uid, ids, mode, context=None, values=None):
- """Check access wrt. res_model, relax the rule of ir.attachment parent
- With 'document' installed, everybody will have access to attachments of
- any resources they can *read*.
- """
- return super(document_file, self).check(cr, uid, ids, mode='read', context=context, values=values)
+ """Overwrite check to verify access on directory to validate specifications of doc/access_permissions.rst"""
+ super(document_file, self).check(cr, uid, ids, mode, context=context, values=values)
+ if ids:
+ self.pool.get('ir.model.access').check(cr, uid, 'document.directory', mode)
+
+ # use SQL to avoid recursive loop on read
+ cr.execute('SELECT DISTINCT parent_id from ir_attachment WHERE id in %s AND parent_id is not NULL', (tuple(ids),))
+ self.pool.get('document.directory').check_access_rule(cr, uid, [parent_id for (parent_id,) in cr.fetchall()], mode, context=context)
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
# Grab ids, bypassing 'count'
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
index b950b85ac48..ecfe9a1ead3 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
@@ -173,10 +173,9 @@ class account_analytic_line(osv.osv):
data = {}
journal_types = {}
- price = 0.0
+
+ # prepare for iteration on journal and accounts
for line in self.pool.get('account.analytic.line').browse(cr, uid, ids, context=context):
- price += line.amount*-1
- line_name = line.name
if line.journal_id.type not in journal_types:
journal_types[line.journal_id.type] = set()
journal_types[line.journal_id.type].add(line.account_id.id)
@@ -217,53 +216,56 @@ class account_analytic_line(osv.osv):
last_invoice = invoice_obj.create(cr, uid, curr_invoice, context=context2)
invoices.append(last_invoice)
- cr.execute("""SELECT product_id, user_id, to_invoice, sum(unit_amount), product_uom_id
+ cr.execute("""SELECT product_id, user_id, to_invoice, sum(amount), sum(unit_amount), product_uom_id
FROM account_analytic_line as line LEFT JOIN account_analytic_journal journal ON (line.journal_id = journal.id)
WHERE account_id = %s
AND line.id IN %s AND journal.type = %s AND to_invoice IS NOT NULL
GROUP BY product_id, user_id, to_invoice, product_uom_id""", (account.id, tuple(ids), journal_type))
- for product_id, user_id, factor_id, qty, uom in cr.fetchall():
+ for product_id, user_id, factor_id, total_price, qty, uom in cr.fetchall():
+ context2.update({'uom': uom})
+
if data.get('product'):
+ # force product, use its public price
product_id = data['product'][0]
- product = product_obj.browse(cr, uid, product_id, context=context2)
+ unit_price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, context2)
+ elif journal_type == 'general' and product_id:
+ # timesheets, use sale price
+ unit_price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, context2)
+ else:
+ # expenses, using price from amount field
+ unit_price = total_price*-1.0 / qty
+
factor = invoice_factor_obj.browse(cr, uid, factor_id, context=context2)
- factor_name = factor.customer_name and line_name + ' - ' + factor.customer_name or line_name
+ # factor_name = factor.customer_name and line_name + ' - ' + factor.customer_name or line_name
+ factor_name = factor.customer_name
curr_line = {
- 'price_unit': price,
+ 'price_unit': unit_price,
'quantity': qty,
+ 'product_id': product_id or False,
'discount': factor.factor,
'invoice_id': last_invoice,
'name': factor_name,
'uos_id': uom,
'account_analytic_id': account.id,
}
+ product = product_obj.browse(cr, uid, product_id, context=context2)
if product:
factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1]
if factor.customer_name:
factor_name += ' - ' + factor.customer_name
- ctx = context.copy()
- ctx.update({'uom': uom})
-
- # check force product
- if data.get('product'):
- price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, ctx)
-
general_account = product.property_account_income or product.categ_id.property_account_income_categ
if not general_account:
raise osv.except_osv(_("Configuration Error!"), _("Please define income account for product '%s'.") % product.name)
taxes = product.taxes_id or general_account.tax_ids
tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes)
curr_line.update({
- 'price_unit': price,
'invoice_line_tax_id': [(6,0,tax )],
'name': factor_name,
- 'product_id': product_id,
'invoice_line_tax_id': [(6,0,tax)],
'account_id': general_account.id,
})
-
#
# Compute for lines
#
@@ -284,7 +286,6 @@ class account_analytic_line(osv.osv):
if data.get('name', False):
details.append(line['name'])
note.append(u' - '.join(map(lambda x: unicode(x) or '',details)))
-
if note:
curr_line['name'] += "\n" + ("\n".join(map(lambda x: unicode(x) or '',note)))
invoice_line_obj.create(cr, uid, curr_line, context=context)
diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra.py b/addons/l10n_be/wizard/l10n_be_vat_intra.py
index a572c3b83b4..a6c9f3031d7 100644
--- a/addons/l10n_be/wizard/l10n_be_vat_intra.py
+++ b/addons/l10n_be/wizard/l10n_be_vat_intra.py
@@ -202,11 +202,11 @@ class partner_vat_intra(osv.osv_memory):
'vatnum': row['vat'][2:].replace(' ','').upper(),
'vat': row['vat'],
'country': row['vat'][:2],
- 'amount': amt,
+ 'amount': '%.2f' % amt,
'intra_code': row['intra_code'],
'code': intra_code})
- xmldict.update({'dnum': dnum, 'clientnbr': str(seq), 'amountsum': amount_sum, 'partner_wo_vat': p_count})
+ xmldict.update({'dnum': dnum, 'clientnbr': str(seq), 'amountsum': '%.2f' % amount_sum, 'partner_wo_vat': p_count})
return xmldict
def create_xml(self, cursor, user, ids, context=None):
diff --git a/addons/l10n_ca/__openerp__.py b/addons/l10n_ca/__openerp__.py
index 945327a06bc..6ba9907b088 100644
--- a/addons/l10n_ca/__openerp__.py
+++ b/addons/l10n_ca/__openerp__.py
@@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Canada - Accounting',
- 'version': '1.1',
+ 'version': '1.2',
'author': 'Savoir-faire Linux',
'website': 'http://www.savoirfairelinux.com',
'category': 'Localization/Account Charts',
@@ -29,6 +29,28 @@ This is the module to manage the English and French - Canadian accounting chart
===========================================================================================
Canadian accounting charts and localizations.
+
+Fiscal positions
+----------------
+
+When considering taxes to be applied, it is the province where the delivery occurs that matters.
+Therefore we decided to implement the most common case in the fiscal positions: delivery is the
+responsibility of the supplier and done at the customer location.
+
+Some examples:
+
+1) You have a customer from another province and you deliver to his location.
+On the customer, set the fiscal position to his province.
+
+2) You have a customer from another province. However this customer comes to your location
+with their truck to pick up products. On the customer, do not set any fiscal position.
+
+3) An international supplier doesn't charge you any tax. Taxes are charged at customs
+by the customs broker. On the supplier, set the fiscal position to International.
+
+4) An international supplier charge you your provincial tax. They are registered with your
+provincial government and remit taxes themselves. On the supplier, do not set any fiscal
+position.
""",
'depends': [
'base',
diff --git a/addons/l10n_ca/account_chart_en.xml b/addons/l10n_ca/account_chart_en.xml
index 0a596bcd4f6..a929e213842 100644
--- a/addons/l10n_ca/account_chart_en.xml
+++ b/addons/l10n_ca/account_chart_en.xml
@@ -131,7 +131,7 @@
other
-
+
GST receivable
@@ -140,17 +140,43 @@
other
-
+
PST/QST receivable
1183
+ view
+
+ HST receivable
+
+
+
+ 11831
+
other
-
- HST receivable
+
+ HST receivable - 13%
+
+
+
+ 11832
+
+ other
+
+
+ HST receivable - 14%
+
+
+
+ 11833
+
+ other
+
+
+ HST receivable - 15%
@@ -257,7 +283,7 @@
other
-
+
GST to pay
@@ -266,17 +292,43 @@
other
-
+
PST/QST to pay
2133
+ view
+
+ HST to pay
+
+
+
+ 21331
+
other
-
- HST to pay
+
+ HST to pay - 13%
+
+
+
+ 21332
+
+ other
+
+
+ HST to pay - 14%
+
+
+
+ 21333
+
+ other
+
+
+ HST to pay - 15%
diff --git a/addons/l10n_ca/account_chart_fr.xml b/addons/l10n_ca/account_chart_fr.xml
index c168833b733..57e6c84aa71 100644
--- a/addons/l10n_ca/account_chart_fr.xml
+++ b/addons/l10n_ca/account_chart_fr.xml
@@ -130,7 +130,7 @@
other
-
+
TPS à recevoir
@@ -139,17 +139,43 @@
other
-
+
TVP/TVQ à recevoir
1183
+ view
+
+ TVH à recevoir
+
+
+
+ 11831
+
other
-
- TVH à recevoir
+
+ TVH à recevoir - 13%
+
+
+
+ 11832
+
+ other
+
+
+ TVH à recevoir - 14%
+
+
+
+ 11833
+
+ other
+
+
+ TVH à recevoir - 15%
@@ -256,7 +282,7 @@
other
-
+
TPS à payer
@@ -265,17 +291,43 @@
other
-
+
TVP/TVQ à payer
2133
+ view
+
+ TVH à payer
+
+
+
+ 21331
+
other
-
- TVH à payer
+
+ TVH à payer - 13%
+
+
+
+ 21332
+
+ other
+
+
+ TVH à payer - 14%
+
+
+
+ 21333
+
+ other
+
+
+ TVH à payer - 15%
@@ -672,7 +724,7 @@
5112
other
-
+
Achats dans des provinces harmonisées
@@ -680,7 +732,7 @@
5113
other
-
+
Achats dans des provinces non-harmonisées
@@ -688,7 +740,7 @@
5114
other
-
+
Achats à l'étranger
diff --git a/addons/l10n_ca/account_tax_code_en.xml b/addons/l10n_ca/account_tax_code_en.xml
index d446f431c96..77698ae14de 100644
--- a/addons/l10n_ca/account_tax_code_en.xml
+++ b/addons/l10n_ca/account_tax_code_en.xml
@@ -31,6 +31,21 @@
+
+ HST paid - 13%
+
+
+
+
+ HST paid - 14%
+
+
+
+
+ HST paid - 15%
+
+
+
Taxes received
@@ -51,6 +66,21 @@
+
+ HST received - 13%
+
+
+
+
+ HST received - 14%
+
+
+
+
+ HST received - 15%
+
+
+
Taxes Base
@@ -76,6 +106,21 @@
+
+ Base of HST for Sales - 13%
+
+
+
+
+ Base of HST for Sales - 14%
+
+
+
+
+ Base of HST for Sales - 15%
+
+
+
Base of Purchases Tax
@@ -96,5 +141,20 @@
+
+ Base of HST for Purchases - 13%
+
+
+
+
+ Base of HST for Purchases - 14%
+
+
+
+
+ Base of HST for Purchases - 15%
+
+
+
diff --git a/addons/l10n_ca/account_tax_code_fr.xml b/addons/l10n_ca/account_tax_code_fr.xml
index 2b6acd2b992..ac4414922e2 100644
--- a/addons/l10n_ca/account_tax_code_fr.xml
+++ b/addons/l10n_ca/account_tax_code_fr.xml
@@ -16,41 +16,71 @@
-
+
TPS payée
-
+
TVP/TVQ payée
-
+
TVH payée
+
+ TVH payée - 13%
+
+
+
+
+ TVH payée - 14%
+
+
+
+
+ TVH payée - 15%
+
+
+
Taxes reçues
-
+
TPS reçue
-
+
TVP/TVQ reçue
-
+
TVH reçue
+
+ TVH reçue - 13%
+
+
+
+
+ TVH reçue - 14%
+
+
+
+
+ TVH reçue - 15%
+
+
+
Base de taxes
@@ -61,40 +91,70 @@
-
+
Base de la TPS pour les ventes
-
+
Base de la TVP/TVQ pour les ventes
-
+
Base de la TVH pour les ventes
+
+ Base de la TVH pour les ventes - 13%
+
+
+
+
+ Base de la TVH pour les ventes - 14%
+
+
+
+
+ Base de la TVH pour les ventes - 15%
+
+
+
Base des taxes d'achats
-
+
Base de la TPS pour les achats
-
+
Base de la TVP/TVQ pour les achats
-
+
Base de la TVH pour les achats
+
+ Base de la TVH pour les achats - 13%
+
+
+
+
+ Base de la TVH pour les achats - 14%
+
+
+
+
+ Base de la TVH pour les achats - 15%
+
+
+
diff --git a/addons/l10n_ca/account_tax_en.xml b/addons/l10n_ca/account_tax_en.xml
index f0d2670d077..4c15ebb68ed 100644
--- a/addons/l10n_ca/account_tax_en.xml
+++ b/addons/l10n_ca/account_tax_en.xml
@@ -4,6 +4,53 @@
+
+
+
+
+ GST + PST for sales (BC)
+ GSTPST_BC_SALE
+ sale
+ 1
+ percent
+ 1
+
+
+
+
+ GST for sales - 5% (BC)
+ GST
+ sale
+ 0.050000
+ percent
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ PST for sales - 7% (BC)
+ PST
+ sale
+ 0.070000
+ percent
+ 2
+
+
+
+
+
+
+
+
+
@@ -13,6 +60,7 @@
sale
1
percent
+
@@ -35,10 +83,10 @@
- PST for sales - 7%
+ PST for sales - 8% (MB)
PST
sale
- 0.070000
+ 0.080000
percent
2
@@ -50,65 +98,19 @@
-
-
-
-
- GST + PST for sales (PE)
- GSTPST_PE_SALE
- sale
- 1
- 1
- percent
-
-
-
-
- GST for sales - 5% (PE)
- GST
- sale
- 0.050000
- percent
- 1
-
-
-
-
-
-
-
-
-
-
-
-
- PST for sale - 10%
- PST
- sale
- 0.100000
- percent
- 2
-
-
-
-
-
-
-
-
-
-
+
GST + QST for sales
GSTQST_SALE
sale
1
percent
+
-
+
GST for sales - 5% (QC)
GST
@@ -122,10 +124,10 @@
-
+
-
+
QST for sales - 9.975%
QST
@@ -139,7 +141,7 @@
-
+
@@ -151,6 +153,7 @@
sale
1
percent
+
@@ -190,21 +193,6 @@
-
-
- HST for sales - 12%
- HST12_SALE
- sale
- 0.120000
- percent
-
-
-
-
-
-
-
-
HST for sales - 13%
@@ -212,27 +200,27 @@
sale
0.130000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
- HST for sales - 13.5%
- HST135_SALE
+ HST for sales - 14%
+ HST14_SALE
sale
- 0.135000
+ 0.14000
percent
-
-
-
-
-
-
+
+
+
+
+
+
@@ -242,12 +230,12 @@
sale
0.150000
percent
-
-
-
-
-
-
+
+
+
+
+
+
@@ -267,9 +255,55 @@
-
+
+
+
+
+ GST + PST for purchases (BC)
+ GSTPST_BC_PURC
+ purchase
+ 1
+ percent
+ 1
+
+
+
+
+ GST for purchases - 5% (BC)
+ GST
+ purchase
+ 0.050000
+ percent
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ PST for purchases - 7% (BC)
+ PST
+ purchase
+ 0.070000
+ percent
+ 2
+
+
+
+
+
+
+
+
+
@@ -279,6 +313,7 @@
purchase
1
percent
+
@@ -301,10 +336,10 @@
- PST for purchases - 7%
+ PST for purchases - 8% (MB)
PST
purchase
- 0.070000
+ 0.080000
percent
2
@@ -316,65 +351,19 @@
-
-
-
-
- GST + PST for purchases (PE)
- GSTPST_PE_PURC
- purchase
- 1
- 1
- percent
-
-
-
-
- GST for purchases - 5% (PE)
- GST
- purchase
- 0.050000
- percent
- 1
-
-
-
-
-
-
-
-
-
-
-
-
- PST for purchases - 10%
- PST
- purchase
- 0.100000
- percent
- 2
-
-
-
-
-
-
-
-
-
-
+
GST + QST for purchases
GSTQST_PURC
purchase
1
percent
+
-
+
GST for purchases - 5% (QC)
GST
@@ -388,10 +377,10 @@
-
+
-
+
QST for purchases - 9.975%
QST
@@ -405,7 +394,7 @@
-
+
@@ -417,6 +406,7 @@
purchase
1
percent
+
@@ -456,21 +446,6 @@
-
-
- HST for purchases - 12%
- HST12_PURC
- purchase
- 0.120000
- percent
-
-
-
-
-
-
-
-
HST for purchases - 13%
@@ -478,27 +453,27 @@
purchase
0.130000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
- HST for purchases - 13.5%
- HST135_PURC
+ HST for purchases - 14%
+ HST14_PURC
purchase
- 0.135000
+ 0.140000
percent
-
-
-
-
-
-
+
+
+
+
+
+
@@ -508,12 +483,12 @@
purchase
0.150000
percent
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/addons/l10n_ca/account_tax_fr.xml b/addons/l10n_ca/account_tax_fr.xml
index c34f329be3a..6c37befa139 100644
--- a/addons/l10n_ca/account_tax_fr.xml
+++ b/addons/l10n_ca/account_tax_fr.xml
@@ -4,18 +4,66 @@
+
+
+
+
+ TPS + TVP sur les ventes (BC)
+ TPSTVP_BC_SALE
+ sale
+ 1
+ 1
+ percent
+
+
+
+
+ TPS sur les ventes - 5% (BC)
+ TPS
+ sale
+ 0.050000
+ percent
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ TVP sur les ventes - 7% (BC)
+ TVP
+ sale
+ 0.070000
+ percent
+ 2
+
+
+
+
+
+
+
+
+
-
+
TPS + TVP sur les ventes (MB)
TPSTVP_MB_SALE
sale
1
percent
+
-
+
TPS sur les ventes - 5% (MB)
TPS
@@ -26,89 +74,43 @@
-
-
-
-
-
+
+
+
+
+
-
+
- TVP sur les ventes - 7%
+ TVP sur les ventes - 8% (MB)
TVP
sale
- 0.070000
+ 0.080000
percent
2
-
-
-
-
-
-
-
-
-
-
-
- TPS + TVP sur les ventes (PE)
- TPSTVP_PE_SALE
- sale
- 1
- 1
- percent
-
-
-
-
- TPS sur les ventes - 5% (PE)
- TPS
- sale
- 0.050000
- percent
- 1
-
-
-
-
-
-
-
-
-
-
-
-
- TVP for sale - 10%
- TVP
- sale
- 0.100000
- percent
- 2
-
-
-
-
-
-
-
+
+
+
+
+
-
+
TPS + TVQ sur les ventes
TPSTVQ_SALE
sale
1
percent
+
-
+
TPS sur les ventes - 5% (QC)
TPS
@@ -118,11 +120,11 @@
1
-
-
-
-
-
+
+
+
+
+
@@ -135,25 +137,26 @@
2
-
-
-
-
-
+
+
+
+
+
-
+
TPS + TVP sur les ventes (SK)
TPSTVP_SK_SALE
sale
1
percent
+
-
+
TPS sur les ventes - 5% (SK)
TPS
@@ -164,14 +167,14 @@
-
-
-
-
-
+
+
+
+
+
-
+
TVP sur les ventes - 5% (SK)
TVP
@@ -181,78 +184,63 @@
2
-
-
-
-
-
+
+
+
+
+
-
-
- TVH sur les ventes - 12%
- TVH12_SALE
- sale
- 0.120000
- percent
-
-
-
-
-
-
-
-
-
+
TVH sur les ventes - 13%
TVH13_SALE
sale
0.130000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
- TVH sur les ventes - 13.5%
- TVH135_SALE
+ TVH sur les ventes - 14%
+ TVH14_SALE
sale
- 0.135000
+ 0.140000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
TVH sur les ventes - 15%
TVH15_SALE
sale
0.150000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
TPS sur les ventes - 5%
TPS_SALE
@@ -261,27 +249,75 @@
percent
-
-
-
-
+
+
+
+
+
+
+
+
+ TPS + TVP sur les achats (BC)
+ TPSTVP_BC_PURC
+ purchase
+ 1
+ percent
+ 1
+
+
+
+
+ TPS sur les achats - 5% (BC)
+ TPS
+ purchase
+ 0.050000
+ percent
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ TVP sur les achats - 7% (BC)
+ TVP
+ purchase
+ 0.070000
+ percent
+ 2
+
+
+
+
+
+
+
+
+
-
+
TPS + TVP sur les achats (MB)
TPSTVP_MB_PURC
purchase
1
percent
+
-
+
TPS sur les achats - 5% (MB)
TPS
@@ -292,89 +328,43 @@
-
-
-
-
-
+
+
+
+
+
-
+
- TVP sur les achats - 7%
+ TVP sur les achats - 8% (MB)
TVP
purchase
- 0.070000
+ 0.080000
percent
2
-
-
-
-
-
-
-
-
-
-
-
- TPS + TVP sur les achats (PE)
- TPSTVP_PE_PURC
- purchase
- 1
- 1
- percent
-
-
-
-
- TPS sur les achats - 5% (PE)
- TPS
- purchase
- 0.050000
- percent
- 1
-
-
-
-
-
-
-
-
-
-
-
-
- TVP sur les achats - 10%
- TVP
- purchase
- 0.100000
- percent
- 2
-
-
-
-
-
-
-
+
+
+
+
+
-
+
TPS + TVQ sur les achats
TPSTVQ_PURC
purchase
1
percent
+
-
+
TPS sur les achats - 5% (QC)
TPS
@@ -384,11 +374,11 @@
1
-
-
-
-
-
+
+
+
+
+
@@ -401,25 +391,26 @@
2
-
-
-
-
-
+
+
+
+
+
-
+
TPS + TVP sur les achats (SK)
TPSTVP_SK_PURC
purchase
1
percent
+
-
+
TPS sur les achats - 5% (SK)
TPS
@@ -430,14 +421,14 @@
-
-
-
-
-
+
+
+
+
+
-
+
TVP sur les achats - 5% (SK)
TVP
@@ -447,78 +438,63 @@
2
-
-
-
-
-
+
+
+
+
+
-
-
- TVH sur les achats - 12%
- TVH12_PURC
- purchase
- 0.120000
- percent
-
-
-
-
-
-
-
-
-
+
TVH sur les achats - 13%
TVH13_PURC
purchase
0.130000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
- TVH sur les achats - 13.5%
- TVH135_PURC
+ TVH sur les achats - 14%
+ TVH14_PURC
purchase
- 0.135000
+ 0.140000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
TVH sur les achats - 15%
TVH15_PURC
purchase
0.150000
percent
-
-
-
-
-
-
+
+
+
+
+
+
-
+
TPS sur les achats - 5%
TPS_PURC
@@ -527,10 +503,10 @@
percent
-
-
-
-
+
+
+
+
diff --git a/addons/l10n_ca/doc/Taxes.csv b/addons/l10n_ca/doc/Taxes.csv
new file mode 100644
index 00000000000..368b06d1c1a
--- /dev/null
+++ b/addons/l10n_ca/doc/Taxes.csv
@@ -0,0 +1,23 @@
+;Product/Service is delivered in;;;;;;;;;;;;;
+Supplier is in ;Alberta;British Columbia;Manitoba;New Brunswick;"Newfoundland
+And Labrador";Nova Scotia;"Northwest
+Territories";Nunavut;Ontario;"Prince Edward
+Islands";Quebec;Saskatchewan;Yukon;International
+Alberta;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+British Columbia;GST – 5%;"GST – 5%
+PST – 7%";GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Manitoba;GST – 5%;GST – 5%;"GST – 5%
+PST – 8%";HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+New Brunswick;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Newfoundland and Labrador;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Nova Scotia;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Northwest Territories;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Nunavut;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Ontario;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Prince Edward Islands;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+Quebec;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;"GST – 5%
+QST – 9,975%";GST – 5%;GST – 5%;
+Saskatchewan;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;"GST – 5%
+PST – 5%";GST – 5%;
+Yukon;GST – 5%;GST – 5%;GST – 5%;HST – 13%;HST – 13%;HST – 15%;GST – 5%;GST – 5%;HST – 13%;HST – 14%;GST – 5%;GST – 5%;GST – 5%;
+International;;;;;;;;;;;;;;
diff --git a/addons/l10n_ca/fiscal_templates_en.xml b/addons/l10n_ca/fiscal_templates_en.xml
index a3bab5b89dd..5bdd72b0c1d 100644
--- a/addons/l10n_ca/fiscal_templates_en.xml
+++ b/addons/l10n_ca/fiscal_templates_en.xml
@@ -4,653 +4,1543 @@
-
- Provincial Regime (PROV)
+
+ Alberta (AB)
-
- Harmonized Provinces Regime (12%) (BC)
+
+ British Columbia (BC)
-
- Harmonized Provinces Regime (13%) (ON, NB, NL)
+
+ Manitoba (MB)
-
- Harmonized Provinces Regime (13.5%)
+
+ New Brunswick (NB)
-
- Harmonized Provinces Regime (15%) (NS)
+
+ Newfoundland and Labrador (NL)
-
- Non-Harmonized Provinces Regime (AB, MB, SK, PE, NT, NU, YT)
+
+ Nova Scotia (NS)
-
- International Regime (INTL)
+
+ Northwest Territories (NT)
-
+
+ Nunavut (NU)
+
+
+
+
+ Ontario (ON)
+
+
+
+
+ Prince Edward Islands (PE)
+
+
+
+
+ Quebec (QC)
+
+
+
+
+ Saskatchewan (SK)
+
+
+
+
+ Yukon (YT)
+
+
+
+
+ International (INTL)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+ Already created by nb2mb_sale
+
+
+
+
+
-
-
-
-
+ Already creted by nb2ns_sale
+
+
+
+
-
-
-
-
+ Already creted by nb2nt_sale
+
+
+
+
-
-
-
-
+ Already created nb2nu_sale
+
+
+
+
-
-
-
-
+ Already created by nb2pe_sale
+
+
+
+
-
-
-
-
+ Already created by nb2qc_sale
+
+
+
+
-
-
-
+ Already created by nb2sk_sale
+
+
+
+
-
+ Already created by nb2yt_sale
+
+
+
+
+
-
-
-
-
+ Already created by nb2intl_sale
+
+
+
+ -->
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+ Already created by ab2ns_sale
+
+
+
+
+
-
-
-
-
+ Already created by ab2on_sale
+
+
+
+
-
-
-
-
+ Already created by ab2pe_sale
+
+
+
+
-
-
-
-
+ Already created by ab2intl_sale
+
+
+
+ -->
-
-
-
-
+
+
+
+
+
-
-
-
+
+ Already created by ab2nl_sale
+
+
+
+
+
-
-
-
-
+ Already created by ab2ns_sale
+
+
+
+
-
-
-
-
+ Already created by ab2on_sale
+
+
+
+
-
-
-
-
+ Already created by ab2pe_sale
+
+
+
+
-
-
-
-
+ Already created by ab2intl_sale
+
+
+
+ -->
+
+
-
-
-
-
+
-
-
-
+
+
+
+ Already created by nb2mb_sale
+
+
+
+
+
+ Already created by nb2ns_sale
+
+
+
+
+
-
+ Already created by nb2nt_sale
+
+
+
+
+
+
+ Already created nb2nu_sale
+
+
+
+
+
-
-
-
-
+ Already created by nb2pe_sale
+
+
+
+
-
-
-
-
+ Already created by nb2qc_sale
+
+
+
+
-
-
-
-
+ Already created by nb2sk_sale
+
+
+
+
-
-
-
-
+ Already created by nb2yt_sale
+
+
+
+
-
-
-
+ Already created by nb2intl_sale
+
+
+
+ -->
-
+
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/addons/l10n_ca/fiscal_templates_fr.xml b/addons/l10n_ca/fiscal_templates_fr.xml
index b01ab0985ea..465f53a1229 100644
--- a/addons/l10n_ca/fiscal_templates_fr.xml
+++ b/addons/l10n_ca/fiscal_templates_fr.xml
@@ -4,653 +4,1543 @@
-
- Régime Provincial (PROV)
+
+ Alberta (AB)
-
- Régime Provinces Harmonisées à 12% (BC)
+
+ British Columbia (BC)
-
- Régime Provinces Harmonisées à 13% (NB, ON, NL)
+
+ Manitoba (MB)
-
- Régime Provinces Harmonisées à 13.5% ()
+
+ New Brunswick (NB)
-
- Régime Provinces Harmonisées à 15% (NS)
+
+ Newfoundland and Labrador (NL)
-
- Régime Provinces Non-Harmonisées (AB, MB, SK, PE, NT, NU, YT)
+
+ Nova Scotia (NS)
-
- Régime International (INTL)
+
+ Northwest Territories (NT)
-
+
+ Nunavut (NU)
+
+
+
+
+ Ontario (ON)
+
+
+
+
+ Prince Edward Islands (PE)
+
+
+
+
+ Quebec (QC)
+
+
+
+
+ Saskatchewan (SK)
+
+
+
+
+ Yukon (YT)
+
+
+
+
+ International (INTL)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+ Already created by nb2mb_sale
+
+
+
+
+
-
-
-
-
+ Already creted by nb2ns_sale
+
+
+
+
-
-
-
-
+ Already creted by nb2nt_sale
+
+
+
+
-
-
-
-
+ Already created nb2nu_sale
+
+
+
+
-
-
-
-
+ Already created by nb2pe_sale
+
+
+
+
-
-
-
-
+ Already created by nb2qc_sale
+
+
+
+
-
-
-
+ Already created by nb2sk_sale
+
+
+
+
-
+ Already created by nb2yt_sale
+
+
+
+
+
-
-
-
-
+ Already created by nb2intl_sale
+
+
+
+ -->
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+ Already created by ab2ns_sale
+
+
+
+
+
-
-
-
-
+ Already created by ab2on_sale
+
+
+
+
-
-
-
-
+ Already created by ab2pe_sale
+
+
+
+
-
-
-
-
+ Already created by ab2intl_sale
+
+
+
+ -->
-
-
-
-
+
+
+
+
+
-
-
-
+
+ Already created by ab2nl_sale
+
+
+
+
+
-
-
-
-
+ Already created by ab2ns_sale
+
+
+
+
-
-
-
-
+ Already created by ab2on_sale
+
+
+
+
-
-
-
-
+ Already created by ab2pe_sale
+
+
+
+
-
-
-
-
+ Already created by ab2intl_sale
+
+
+
+ -->
+
+
-
-
-
-
+
-
-
-
+
+
+
+ Already created by nb2mb_sale
+
+
+
+
+
+ Already created by nb2ns_sale
+
+
+
+
+
-
+ Already created by nb2nt_sale
+
+
+
+
+
+
+ Already created nb2nu_sale
+
+
+
+
+
-
-
-
-
+ Already created by nb2pe_sale
+
+
+
+
-
-
-
-
+ Already created by nb2qc_sale
+
+
+
+
-
-
-
-
+ Already created by nb2sk_sale
+
+
+
+
-
-
-
-
+ Already created by nb2yt_sale
+
+
+
+
-
-
-
+ Already created by nb2intl_sale
+
+
+
+ -->
-
+
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py
index 40f0cd28dd5..fc68b2e889b 100644
--- a/addons/mail/mail_mail.py
+++ b/addons/mail/mail_mail.py
@@ -305,6 +305,7 @@ class mail_mail(osv.Model):
email_list.append(self.send_get_email_dict(cr, uid, mail, partner=partner, context=context))
# build an RFC2822 email.message.Message object and send it without queuing
+ res = None
for email in email_list:
msg = ir_mail_server.build_email(
email_from = mail.email_from,
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 7fb40ce12af..f51f7292c76 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -23,11 +23,12 @@ import time
from datetime import datetime
import openerp.addons.decimal_precision as dp
-from openerp.osv import fields, osv
+from openerp.osv import fields, osv, orm
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP
from openerp.tools import float_compare
from openerp.tools.translate import _
from openerp import tools
+from openerp import SUPERUSER_ID
#----------------------------------------------------------
# Work Centers
@@ -405,12 +406,20 @@ class mrp_production(osv.osv):
return result
def _src_id_default(self, cr, uid, ids, context=None):
- src_location_id = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock', context=context)
- return src_location_id.id
+ try:
+ location_model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
+ self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
+ except (orm.except_orm, ValueError):
+ location_id = False
+ return location_id
def _dest_id_default(self, cr, uid, ids, context=None):
- dest_location_id = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock', context=context)
- return dest_location_id.id
+ try:
+ location_model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
+ self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
+ except (orm.except_orm, ValueError):
+ location_id = False
+ return location_id
def _get_progress(self, cr, uid, ids, name, arg, context=None):
""" Return product quantity percentage """
@@ -605,8 +614,12 @@ class mrp_production(osv.osv):
prod_line_obj = self.pool.get('mrp.production.product.line')
workcenter_line_obj = self.pool.get('mrp.production.workcenter.line')
for production in self.browse(cr, uid, ids):
- cr.execute('delete from mrp_production_product_line where production_id=%s', (production.id,))
- cr.execute('delete from mrp_production_workcenter_line where production_id=%s', (production.id,))
+
+ p_ids = prod_line_obj.search(cr, SUPERUSER_ID, [('production_id', '=', production.id)], context=context)
+ prod_line_obj.unlink(cr, SUPERUSER_ID, p_ids, context=context)
+ w_ids = workcenter_line_obj.search(cr, SUPERUSER_ID, [('production_id', '=', production.id)], context=context)
+ workcenter_line_obj.unlink(cr, SUPERUSER_ID, w_ids, context=context)
+
bom_point = production.bom_id
bom_id = production.bom_id.id
if not bom_point:
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index 2af1e876c70..a09c2ef4e17 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -620,8 +620,8 @@