[IMP] account_chart_update: improve extensibility
This commit is contained in:
parent
8172b7158a
commit
c630022abf
@ -778,6 +778,13 @@ class WizardUpdateChartsAccounts(models.TransientModel):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _domain_taxes_to_deactivate(self, found_taxes_ids):
|
||||||
|
return [
|
||||||
|
("company_id", "=", self.company_id.id),
|
||||||
|
("id", "not in", found_taxes_ids),
|
||||||
|
("active", "=", True),
|
||||||
|
]
|
||||||
|
|
||||||
def _find_taxes(self):
|
def _find_taxes(self):
|
||||||
"""Search for, and load, tax templates to create/update/delete."""
|
"""Search for, and load, tax templates to create/update/delete."""
|
||||||
found_taxes_ids = []
|
found_taxes_ids = []
|
||||||
@ -821,11 +828,7 @@ class WizardUpdateChartsAccounts(models.TransientModel):
|
|||||||
# search for taxes not in the template and propose them for
|
# search for taxes not in the template and propose them for
|
||||||
# deactivation
|
# deactivation
|
||||||
taxes_to_deactivate = self.env["account.tax"].search(
|
taxes_to_deactivate = self.env["account.tax"].search(
|
||||||
[
|
self._domain_taxes_to_deactivate(found_taxes_ids)
|
||||||
("company_id", "=", self.company_id.id),
|
|
||||||
("id", "not in", found_taxes_ids),
|
|
||||||
("active", "=", True),
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
for tax in taxes_to_deactivate:
|
for tax in taxes_to_deactivate:
|
||||||
self.tax_ids.create(
|
self.tax_ids.create(
|
||||||
|
Loading…
Reference in New Issue
Block a user