From b649b18dd5afd14855eb07992cd241a44ca17759 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 13 Dec 2019 09:09:49 +0000 Subject: [PATCH] [IMP] account: remove dynamic domain on partner Pretty straightforward so long as you know `current_company_id` is the currently active company for the user, which is exactly what we need. Task 2115472 closes odoo/odoo#41869 Signed-off-by: Xavier Morel (xmo) --- addons/account/models/partner.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 21621cb17b1..99678c3aee4 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -403,6 +403,7 @@ class ResPartner(models.Model): required=True) property_account_position_id = fields.Many2one('account.fiscal.position', company_dependent=True, string="Fiscal Position", + domain="[('company_id', 'in', [company_id or current_company_id, False])]", help="The fiscal position determines the taxes/accounts used for this contact.") property_payment_term_id = fields.Many2one('account.payment.term', company_dependent=True, string='Customer Payment Terms', @@ -471,14 +472,6 @@ class ResPartner(models.Model): action['context'] = {'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale', 'search_default_unpaid': 1} return action - @api.onchange('company_id') - def _onchange_company_id(self): - if self.company_id: - company = self.company_id - else: - company = self.env.company - return {'domain': {'property_account_position_id': [('company_id', 'in', [company.id, False])]}} - def can_edit_vat(self): ''' Can't edit `vat` if there is (non draft) issued invoices. ''' can_edit_vat = super(ResPartner, self).can_edit_vat()