diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index af8d0105877..80b28be3887 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -394,8 +394,7 @@ class ResPartner(models.Model): required=True) property_account_position_id = fields.Many2one('account.fiscal.position', company_dependent=True, string="Fiscal Position", - help="The fiscal position will determine taxes and accounts used for the partner.", oldname="property_account_position", - domain="[('company_id', 'in', [company_id, False])]") + help="The fiscal position will determine taxes and accounts used for the partner.", oldname="property_account_position") property_payment_term_id = fields.Many2one('account.payment.term', company_dependent=True, string='Customer Payment Terms', help="This payment term will be used instead of the default one for sales orders and customer invoices", oldname="property_payment_term") @@ -445,5 +444,9 @@ class ResPartner(models.Model): @api.onchange('company_id') def _onchange_company_id(self): + company = self.env['res.company'] if self.company_id: - return {'domain': {'property_account_position_id': [('company_id', 'in', [self.company_id.id, False])]}} + company = self.company_id + else: + company = self.env.user.company_id + return {'domain': {'property_account_position_id': [('company_id', 'in', [company.id, False])]}}