← Back to team overview

openerp-community-reviewer team mailing list archive

lp:~acsone-openerp/account-financial-tools/account_chart_update_tac_code_code into lp:account-financial-tools

 

Stéphane Bidoul (Acsone) has proposed merging lp:~acsone-openerp/account-financial-tools/account_chart_update_tac_code_code into lp:account-financial-tools with lp:~acsone-openerp/account-financial-tools/account_credit_control_portal_portal_lp1248906 as a prerequisite.

Requested reviews:
  Account Core Editors (account-core-editors)

For more details, see:
https://code.launchpad.net/~acsone-openerp/account-financial-tools/account_chart_update_tac_code_code/+merge/195630

Hi,

Here is a small improvement to account_chart_update.

When a tax_code cannot be matched by name, attempt to match by code if one exists.

Thanks for this excellent tool.

Best regards,

-sbi
-- 
https://code.launchpad.net/~acsone-openerp/account-financial-tools/account_chart_update_tac_code_code/+merge/195630
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch lp:account-financial-tools.
=== modified file 'account_chart_update/wizard/wizard_chart_update.py'
--- account_chart_update/wizard/wizard_chart_update.py	2013-10-18 16:44:19 +0000
+++ account_chart_update/wizard/wizard_chart_update.py	2013-11-18 16:22:00 +0000
@@ -270,6 +270,18 @@
             if tax_code_ids:
                 tax_code_template_mapping[
                     tax_code_template.id] = tax_code_ids[0]
+            else:
+                # if we could not match no tax code template name, 
+                # try to match on tax code template code, if any 
+                tax_code_code = tax_code_template.code
+                if tax_code_code:
+                    tax_code_ids = tax_codes.search(cr, uid, [
+                        ('code', '=', tax_code_code),
+                        ('company_id', '=', wizard.company_id.id)
+                    ])
+                    if tax_code_ids:
+                        tax_code_template_mapping[
+                            tax_code_template.id] = tax_code_ids[0]
 
     def _map_account_template(self, cr, uid, wizard, account_template_mapping, account_template, context=None):
         """