From ef00131d12485a67bb999c24dd695f5a50b6a891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Wed, 24 Dec 2014 15:03:42 +0100 Subject: [PATCH] [IMP] account_chart_update: compare more fields in taxes --- .../wizard/wizard_chart_update.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/account_chart_update/wizard/wizard_chart_update.py b/account_chart_update/wizard/wizard_chart_update.py index 38f2d67e1..319162401 100644 --- a/account_chart_update/wizard/wizard_chart_update.py +++ b/account_chart_update/wizard/wizard_chart_update.py @@ -578,6 +578,8 @@ class wizard_update_charts_accounts(orm.TransientModel): new_taxes = 0 updated_taxes = 0 tax_templ_mapping = {} + tax_code_template_mapping = {} + acc_templ_mapping = {} tax_obj = self.pool['account.tax'] tax_templ_obj = self.pool['account.tax.template'] wiz_taxes_obj = self.pool['wizard.update.charts.accounts.tax'] @@ -648,6 +650,46 @@ class wizard_update_charts_accounts(orm.TransientModel): if tax.type_tax_use != tax_templ.type_tax_use: notes += _("The type tax use field is different.\n") modified = True + # compare tax code fields + if tax.base_code_id.id != self._map_tax_code_template( + cr, uid, wizard, + tax_code_template_mapping, + tax_templ.base_code_id, context=context): + notes += _("The base_code_id field is different.\n") + modified = True + if tax.tax_code_id.id != self._map_tax_code_template( + cr, uid, wizard, + tax_code_template_mapping, + tax_templ.tax_code_id, context=context): + notes += _("The tax_code_id field is different.\n") + modified = True + if tax.ref_base_code_id.id != self._map_tax_code_template( + cr, uid, wizard, + tax_code_template_mapping, + tax_templ.ref_base_code_id, context=context): + notes += _("The ref_base_code_id field is different.\n") + modified = True + if tax.ref_tax_code_id.id != self._map_tax_code_template( + cr, uid, wizard, + tax_code_template_mapping, + tax_templ.ref_tax_code_id, context=context): + notes += _("The ref_tax_code_id field is different.\n") + modified = True + # compare tax account fields + if tax.account_paid_id.id != self._map_account_template( + cr, uid, wizard, + acc_templ_mapping, + tax_templ.account_paid_id, + context=context): + notes += _("The account_paid field is different.\n") + modified = True + if tax.account_collected_id.id != self._map_account_template( + cr, uid, wizard, + acc_templ_mapping, + tax_templ.account_collected_id, + context=context): + notes += _("The account_collected field is different.\n") + modified = True # TODO: We could check other tax fields for changes... if modified: # Tax code to update.