Merge lp:~acsone-openerp/account-financial-tools/account_chart_update_tac_code_code into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Stéphane Bidoul (Acsone)
Status: Superseded
Proposed branch: lp:~acsone-openerp/account-financial-tools/account_chart_update_tac_code_code
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Prerequisite: lp:~acsone-openerp/account-financial-tools/account_credit_control_portal_portal_lp1248906
Diff against target: 22 lines (+12/-0)
1 file modified
account_chart_update/wizard/wizard_chart_update.py (+12/-0)
To merge this branch: bzr merge lp:~acsone-openerp/account-financial-tools/account_chart_update_tac_code_code
Reviewer Review Type Date Requested Status
Account Core Editors Pending
Review via email: mp+195630@code.launchpad.net

This proposal supersedes a proposal from 2013-11-18.

This proposal has been superseded by a proposal from 2014-01-07.

Description of the change

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

To post a comment you must log in.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote : Posted in a previous version of this proposal

Hi Stéphane,

For me your contribution is ok ,thanks you. just a point, I think you include in your commit (probably by mistake) a change in the "account_credit_control/security/ir.model.access.csv" file.

Can you remove it please ?

review: Needs Fixing (code review, no tests)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote : Posted in a previous version of this proposal

Hi, Stéphane, thank you very much for the improvement. Apart from the problem said by Joël, I think you can improve the code putting this:

if not tax_code_ids:
    # 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]

Regards.

review: Needs Fixing (code review, no test)

Unmerged revisions

126. By Stéphane Bidoul (Acsone)

[IMP] attempt to match tax code on code if no match on name was found

125. By Stéphane Bidoul (Acsone)

[FIX] fix bug in account_credit_control preventing portal user to view their invoices

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_chart_update/wizard/wizard_chart_update.py'
2--- account_chart_update/wizard/wizard_chart_update.py 2013-10-18 16:44:19 +0000
3+++ account_chart_update/wizard/wizard_chart_update.py 2013-11-18 16:22:00 +0000
4@@ -270,6 +270,18 @@
5 if tax_code_ids:
6 tax_code_template_mapping[
7 tax_code_template.id] = tax_code_ids[0]
8+ else:
9+ # if we could not match no tax code template name,
10+ # try to match on tax code template code, if any
11+ tax_code_code = tax_code_template.code
12+ if tax_code_code:
13+ tax_code_ids = tax_codes.search(cr, uid, [
14+ ('code', '=', tax_code_code),
15+ ('company_id', '=', wizard.company_id.id)
16+ ])
17+ if tax_code_ids:
18+ tax_code_template_mapping[
19+ tax_code_template.id] = tax_code_ids[0]
20
21 def _map_account_template(self, cr, uid, wizard, account_template_mapping, account_template, context=None):
22 """

Subscribers

People subscribed via source and target branches