2020-05-04 15:17:28 +02:00
|
|
|
# Copyright (C) 2019-Today GRAP (http://www.grap.coop)
|
|
|
|
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
|
|
|
|
|
|
class AccountFiscalPositionTaxTemplate(models.Model):
|
|
|
|
_inherit = "account.fiscal.position.tax.template"
|
|
|
|
|
2022-11-03 23:25:22 +01:00
|
|
|
active = fields.Boolean(default=True)
|
2020-05-04 15:17:28 +02:00
|
|
|
|
|
|
|
def write(self, vals):
|
|
|
|
TaxTemplate = self.env["account.tax.template"]
|
|
|
|
if vals.get("active", False):
|
|
|
|
# enable account.fiscal.position.tax.template should enable
|
|
|
|
# related account.tax.template
|
|
|
|
tax_ids = set(
|
2021-05-18 11:52:53 +02:00
|
|
|
self.mapped("tax_src_id").ids + self.mapped("tax_dest_id").ids
|
2020-05-04 15:17:28 +02:00
|
|
|
)
|
|
|
|
taxTemplates = TaxTemplate.browse(tax_ids)
|
|
|
|
taxTemplates.write({"active": True})
|
|
|
|
return super().write(vals)
|