[FIX] account: allow forcing company when fetching fpos
The code to fetch the fiscal position of a partner uses ACLs and ir_rules to select the correct ones, but when calling the function as admin, multi-company rules flight out the window. By allowing to force a company in the context, we can get the fpos as the admin from the pov of any company.
This commit is contained in:
committed by
Cedric Snauwaert
parent
a0e04afe62
commit
8ae6406a37
@@ -123,6 +123,8 @@ class AccountFiscalPosition(models.Model):
|
||||
if not country_id:
|
||||
return False
|
||||
base_domain = [('auto_apply', '=', True), ('vat_required', '=', vat_required)]
|
||||
if self.env.context.get('force_company'):
|
||||
base_domain.append(('company_id', '=', self.env.context.get('force_company')))
|
||||
null_state_dom = state_domain = [('state_ids', '=', False)]
|
||||
null_zip_dom = zip_domain = [('zip_from', '=', 0), ('zip_to', '=', 0)]
|
||||
null_country_dom = [('country_id', '=', False), ('country_group_id', '=', False)]
|
||||
|
||||
Reference in New Issue
Block a user