[FIX] account: partner's fiscal position chosen within its company
Before this commit, a partner in a company could have a fiscal position belonging to another company Namely, the search view on the field property account position displayed every fiscal position This could create problems afterwards, when managing an invoice from a restricted rights user (with an access right error raising) After this commit, we soflty constrain the choice of the fiscal position to the ones belonging to the same company of the partner OPW 1833848 OPW 1827831 closes #24056
This commit is contained in:
@@ -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])]}}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user