diff --git a/account_chart_update/README.rst b/account_chart_update/README.rst index 622e24ea..7c20b3ef 100644 --- a/account_chart_update/README.rst +++ b/account_chart_update/README.rst @@ -38,6 +38,7 @@ Contributors * Joaquín Gutierrez * invitu * Stéphane Bidoul +* Antonio Espinosa Maintainer ---------- diff --git a/account_chart_update/wizard/wizard_chart_update.py b/account_chart_update/wizard/wizard_chart_update.py index 89703ac7..e066ada3 100644 --- a/account_chart_update/wizard/wizard_chart_update.py +++ b/account_chart_update/wizard/wizard_chart_update.py @@ -4,6 +4,8 @@ # Copyright (c) 2010 Zikzakmedia S.L. (http://www.zikzakmedia.com) # Copyright (c) 2010 Pexego Sistemas Informáticos S.L.(http://www.pexego.es) # @authors: Jordi Esteve (Zikzakmedia), Borja López Soilán (Pexego) +# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com) +# Antonio Espinosa # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published @@ -560,12 +562,14 @@ class WizardUpdateChartsAccounts(models.TransientModel): 'notes': _("To deactivate: not in the template"), }) - def _is_different_tax(self, tax, tax_template, mapping_tax_codes, - mapping_accounts): + def _is_different_tax(self, tax, tax_template, mapping_taxes, + mapping_tax_codes, mapping_accounts): """Check the tax for changes. :return: An string that will be empty if no change detected. """ notes = "" + if not tax.active: + notes += _("Tax is disabled.\n") if tax.name != tax_template.name: notes += _("The name field is different.\n") if tax.description != tax_template.description: @@ -582,6 +586,9 @@ class WizardUpdateChartsAccounts(models.TransientModel): notes += _("The domain field is different.\n") if tax.child_depend != tax_template.child_depend: notes += _("The child depend field is different.\n") + if tax.parent_id != self.map_tax_template(tax_template.parent_id, + mapping_taxes): + notes += _("The parent_id field is different.\n") if tax.python_compute != tax_template.python_compute: notes += _("The python compute field is different.\n") # if tax.tax_group != tax_template.tax_group: @@ -648,7 +655,8 @@ class WizardUpdateChartsAccounts(models.TransientModel): else: # Check the tax for changes. notes = self._is_different_tax( - tax, tax_template, mapping_tax_codes, mapping_accounts) + tax, tax_template, mapping_taxes, mapping_tax_codes, + mapping_accounts) if notes: # Tax code to update. wiz_taxes_obj.create({ @@ -754,9 +762,10 @@ class WizardUpdateChartsAccounts(models.TransientModel): break if not found: msg = fp_tax_templ.tax_dest_id.name or _('None') - notes += _("Tax mapping not found on the fiscal position " - "instance: %s -> %s.\n") % ( - fp_tax_templ.tax_src_id.name, msg) + notes += _( + "Tax mapping not found on the fiscal position " + "instance: %s -> %s.\n") % ( + fp_tax_templ.tax_src_id.name, msg) elif fp_template.tax_ids and not fp.tax_ids: notes += _("The template has taxes the fiscal position instance " "does not.\n") @@ -777,8 +786,8 @@ class WizardUpdateChartsAccounts(models.TransientModel): notes += _( "Account mapping not found on the fiscal " "position instance: %s -> %s.\n") % ( - fp_acc_templ.account_src_id.name, - fp_acc_templ.account_dest_id.name) + fp_acc_templ.account_src_id.name, + fp_acc_templ.account_dest_id.name) elif fp_template.account_ids and not fp.account_ids: notes += _("The template has accounts the fiscal position " "instance does not.\n") @@ -872,6 +881,7 @@ class WizardUpdateChartsAccounts(models.TransientModel): def _prepare_tax_vals(self, tax_template, mapping_tax_codes, mapping_taxes): return { + 'active': True, 'name': tax_template.name, 'sequence': tax_template.sequence, 'amount': tax_template.amount,