From: Raphael Collet Date: Tue, 9 Sep 2014 09:42:50 +0000 (+0200) Subject: [FIX] account.invoice.line: move context to last position in onchange methods X-Git-Tag: 8.0.0~119 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=ecd8b5222bacbde1cc7ea231f93547a85053aa3e;p=odoo%2Fodoo.git [FIX] account.invoice.line: move context to last position in onchange methods The methods product_id_change() and uos_id_change() have been converted to the new api, and now use the decorator @multi. When invoked with the old api, by convention the methods will take the last argument as the context. But this will not work properly for those methods, as the context is passed in another position. In order to avoid an argument swap in the api wrapper, we moved the context to its expected position. Fixes #1943 --- diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index cdba622..d25a539 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1290,8 +1290,8 @@ class account_invoice_line(models.Model): @api.multi def product_id_change(self, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, - context=None, company_id=None): - context = context or {} + company_id=None): + context = self._context company_id = company_id if company_id is not None else context.get('company_id', False) self = self.with_context(company_id=company_id, force_company=company_id) @@ -1358,14 +1358,14 @@ class account_invoice_line(models.Model): @api.multi def uos_id_change(self, product, uom, qty=0, name='', type='out_invoice', partner_id=False, - fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): - context = context or {} + fposition_id=False, price_unit=False, currency_id=False, company_id=None): + context = self._context company_id = company_id if company_id != None else context.get('company_id', False) self = self.with_context(company_id=company_id) result = self.product_id_change( product, uom, qty, name, type, partner_id, fposition_id, price_unit, - currency_id, context=context, company_id=company_id, + currency_id, company_id=company_id, ) warning = {} if not uom: diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 250c8e2..9e1060c 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -48,12 +48,12 @@
- +