diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 4482b4e1c4c36b796031475105365b54e301b78f..af8d010587732b7232bdae875e684ed3fe64f6ef 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -394,7 +394,8 @@ 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") + help="The fiscal position will determine taxes and accounts used for the partner.", oldname="property_account_position", + domain="[('company_id', 'in', [company_id, False])]") 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") @@ -441,3 +442,8 @@ class ResPartner(models.Model): action['domain'] = literal_eval(action['domain']) action['domain'].append(('partner_id', 'child_of', self.id)) return action + + @api.onchange('company_id') + def _onchange_company_id(self): + if self.company_id: + return {'domain': {'property_account_position_id': [('company_id', 'in', [self.company_id.id, False])]}} diff --git a/addons/account/views/partner_view.xml b/addons/account/views/partner_view.xml index 2ef7098029471c631caa290804c7633897203646..d944200a8b8cf35efab8588404ff3c4cb7b9ced4 100644 --- a/addons/account/views/partner_view.xml +++ b/addons/account/views/partner_view.xml @@ -95,6 +95,7 @@ <field name="priority" eval="20"/> <field name="arch" type="xml"> <field name="email" position="after"> + <field name="company_id" invisible="1"/> <field name="property_payment_term_id" widget="selection"/> <field name="property_account_position_id" options="{'no_create': True, 'no_open': True}"/> </field>