[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
This commit is contained in:
Stéphane Bidoul 2016-02-23 17:05:37 +01:00 committed by Denis Ledoux
parent 68f9f99ed3
commit 4162b8f5fa
1 changed files with 1 additions and 0 deletions

View File

@ -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)