From 4162b8f5fa31cd76fa79c7e810f49b38733a16d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Tue, 23 Feb 2016 17:05:37 +0100 Subject: [PATCH] [FIX] account: fiscal position in multi-company environments Properties depends on with which companies the records are browsed. When retrieving the fiscal position as sudo, the company must therefore be enforced within the context, to make sure to get the properties from the right company. This method can totally be accessed as sudo, within the crons for instance. Before this revision, the recurring invoices cron could retrieve properties from the wrong company, and therefore retrieve the fiscal position of another company. Closes #11039 --- addons/account/partner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/partner.py b/addons/account/partner.py index f60b37fe862..6684222a46e 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -109,6 +109,7 @@ class account_fiscal_position(osv.osv): def get_fiscal_position(self, cr, uid, company_id, partner_id, delivery_id=None, context=None): if not partner_id: return False + context = dict(context or {}, company_id=company_id, force_company=company_id) # This can be easily overriden to apply more complex fiscal rules part_obj = self.pool['res.partner'] partner = part_obj.browse(cr, uid, partner_id, context=context)