[FIX] account: fiscal positions: never map to an inactive tax
When a tax is set to inactive, the fiscal positions mapping other taxes to it continued to apply, disregarding the fact that it shouldn't be used anymore. Not anymore with this fix. closes odoo/odoo#154646 X-original-commit: 07fa1b880875fc075555ca65f4ddd0cddb619979 Signed-off-by: Olivier Colson (oco) <oco@odoo.com> Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
@@ -111,7 +111,7 @@ class AccountFiscalPosition(models.Model):
|
||||
return taxes
|
||||
result = self.env['account.tax']
|
||||
for tax in taxes:
|
||||
taxes_correspondance = self.tax_ids.filtered(lambda t: t.tax_src_id == tax._origin)
|
||||
taxes_correspondance = self.tax_ids.filtered(lambda t: t.tax_src_id == tax._origin and (not t.tax_dest_id or t.tax_dest_active))
|
||||
result |= taxes_correspondance.tax_dest_id if taxes_correspondance else tax
|
||||
return result
|
||||
|
||||
@@ -278,6 +278,7 @@ class AccountFiscalPositionTax(models.Model):
|
||||
company_id = fields.Many2one('res.company', string='Company', related='position_id.company_id', store=True)
|
||||
tax_src_id = fields.Many2one('account.tax', string='Tax on Product', required=True, check_company=True)
|
||||
tax_dest_id = fields.Many2one('account.tax', string='Tax to Apply', check_company=True)
|
||||
tax_dest_active = fields.Boolean(related="tax_dest_id.active")
|
||||
|
||||
_sql_constraints = [
|
||||
('tax_src_dest_uniq',
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
<notebook>
|
||||
<page name="tax_mapping" string="Tax Mapping">
|
||||
<field name="tax_ids" widget="one2many" nolabel="1" context="{'append_type_to_tax_name': True}">
|
||||
<tree name="tax_map_tree" string="Tax Mapping" editable="bottom" no_open="1">
|
||||
<tree name="tax_map_tree" string="Tax Mapping" editable="bottom" no_open="1" decoration-muted="tax_dest_id and not tax_dest_active">
|
||||
<field name="tax_dest_active" invisible="1"/>
|
||||
<field name="tax_src_id"
|
||||
domain="[
|
||||
('type_tax_use', '!=', 'none'),
|
||||
|
||||
Reference in New Issue
Block a user