From ecd8b5222bacbde1cc7ea231f93547a85053aa3e Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 9 Sep 2014 11:42:50 +0200 Subject: [PATCH] [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 --- addons/account/account_invoice.py | 10 +++++----- addons/account/account_invoice_view.xml | 12 ++++++------ .../account_analytic_default.py | 4 ++-- .../account_analytic_plans/account_analytic_plans.py | 4 ++-- addons/account_anglo_saxon/invoice.py | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index cdba622b9b4..d25a53932bc 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 250c8e26fdf..9e1060c64cc 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -48,12 +48,12 @@
- +