From c630022abfbd63fb503dbd01bdb766d8c742f26d Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 24 Oct 2022 13:28:50 +0200 Subject: [PATCH] [IMP] account_chart_update: improve extensibility --- account_chart_update/wizard/wizard_chart_update.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/account_chart_update/wizard/wizard_chart_update.py b/account_chart_update/wizard/wizard_chart_update.py index 915b5bfb..834a1501 100644 --- a/account_chart_update/wizard/wizard_chart_update.py +++ b/account_chart_update/wizard/wizard_chart_update.py @@ -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): """Search for, and load, tax templates to create/update/delete.""" found_taxes_ids = [] @@ -821,11 +828,7 @@ class WizardUpdateChartsAccounts(models.TransientModel): # search for taxes not in the template and propose them for # deactivation taxes_to_deactivate = self.env["account.tax"].search( - [ - ("company_id", "=", self.company_id.id), - ("id", "not in", found_taxes_ids), - ("active", "=", True), - ] + self._domain_taxes_to_deactivate(found_taxes_ids) ) for tax in taxes_to_deactivate: self.tax_ids.create(