[IMP] account_reports: reset country_id when switching the availability condition of a report manually to something else than 'country'
Otherwise, when displaying the field in the view, the field might remain set, causing confusion. closes odoo/odoo#128143 X-original-commit: 003edebd7e90d3e24a2f932c5ff90b1b13758b35 Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
committed by
John Laterre (jol)
parent
f88e827126
commit
f36ad3523b
@@ -129,7 +129,7 @@ class AccountReport(models.Model):
|
||||
else:
|
||||
report[field_name] = default_value
|
||||
|
||||
@api.depends('root_report_id', 'country_id')
|
||||
@api.depends('root_report_id')
|
||||
def _compute_default_availability_condition(self):
|
||||
for report in self:
|
||||
if report.root_report_id:
|
||||
@@ -143,6 +143,11 @@ class AccountReport(models.Model):
|
||||
if report.root_report_id.root_report_id:
|
||||
raise ValidationError(_("Only a report without a root report of its own can be selected as root report."))
|
||||
|
||||
@api.onchange('availability_condition')
|
||||
def _onchange_availability_condition(self):
|
||||
if self.availability_condition != 'country':
|
||||
self.country_id = None
|
||||
|
||||
def write(self, vals):
|
||||
# Overridden so that changing the country of a report also creates new tax tags if necessary, or updates the country
|
||||
# of existing tags, if they aren't shared with another report.
|
||||
|
||||
Reference in New Issue
Block a user