From 43fe238c96c27d923e41eb6276a02dd700d48ed9 Mon Sep 17 00:00:00 2001 From: "Jay (OpenERP)" Date: Wed, 6 Oct 2010 19:57:45 +0530 Subject: [PATCH] [FIX] Account/stock : Better context-handling at tax computation to avoid wrong context-passing bzr revid: jvo@tinyerp.com-20101006142745-hosp53x09d6hjnr5 --- addons/account/invoice.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 1aa4e30d95d..777955d5a8e 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -650,18 +650,19 @@ class account_invoice(osv.osv): return ok def button_reset_taxes(self, cr, uid, ids, context=None): - if not context: + if context is None: context = {} + ctx = context.copy() ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) - partner = self.browse(cr, uid, id, context=context).partner_id + partner = self.browse(cr, uid, id, context=ctx).partner_id if partner.lang: - context.update({'lang': partner.lang}) - for taxe in ait_obj.compute(cr, uid, id, context=context).values(): + ctx.update({'lang': partner.lang}) + for taxe in ait_obj.compute(cr, uid, id, context=ctx).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute - self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) + self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx) return True def button_compute(self, cr, uid, ids, context=None, set_total=False):