Merge lp:~agilebg/account-consolidation/7.0-fix-1334645-elbati into lp:~account-core-editors/account-consolidation/7.0

Proposed by Lorenzo Battistini
Status: Needs review
Proposed branch: lp:~agilebg/account-consolidation/7.0-fix-1334645-elbati
Merge into: lp:~account-core-editors/account-consolidation/7.0
Diff against target: 31 lines (+8/-6)
1 file modified
account_parallel_currency/account.py (+8/-6)
To merge this branch: bzr merge lp:~agilebg/account-consolidation/7.0-fix-1334645-elbati
Reviewer Review Type Date Requested Status
Leonardo Pistone Approve
Review via email: mp+225266@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Leonardo Pistone (lepistone) wrote :

thanks for the fix Lorenzo.

Can you confirm that the test is correct and production code was actually broken?

review: Needs Information
Revision history for this message
Lorenzo Battistini (elbati) wrote :

I confirm.
Note that the bug only occurs when you create a new tax code without parent.

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Hi Lorenzo,

I am still non convinced :)

This way the test is not actually testing a useful workflow, but just a "return True" workaround.

I'd be happier if the yaml test actually tested a realistic case. (or at least, clarify in the yaml file what's going on)

Thanks!

review: Needs Fixing
24. By Lorenzo Battistini

[IMP] when parent_id is missing, just don't fill the parent_id field of the parallel account

Revision history for this message
Lorenzo Battistini (elbati) wrote :

lep, right. I looked at it better and saw that if parent_id is missing, I should just not fill the parent_id field of the parallel account.

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Thanks Lorenzo.

maybe you could refactor a bit putting

parent_parallel_tax_code_id = False

in an else: block a few lines down? otherwise, lgtm

review: Needs Fixing
25. By Lorenzo Battistini

[IMP] else block

Revision history for this message
Lorenzo Battistini (elbati) wrote :

On 07/07/2014 03:00 PM, Leonardo Pistone - camptocamp wrote:
> maybe you could refactor a bit putting
>
> parent_parallel_tax_code_id = False
>
> in an else: block a few lines down? otherwise, lgtm

Done

Revision history for this message
Leonardo Pistone (lepistone) wrote :

thanks

review: Approve
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

This project is now hosted on https://github.com/OCA/account-consolidation. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Unmerged revisions

25. By Lorenzo Battistini

[IMP] else block

24. By Lorenzo Battistini

[IMP] when parent_id is missing, just don't fill the parent_id field of the parallel account

23. By Lorenzo Battistini

[FIX] account_parallel_currency: test failure test/mapping_parallel_accounts.yml

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_parallel_currency/account.py'
--- account_parallel_currency/account.py 2014-03-24 18:16:13 +0000
+++ account_parallel_currency/account.py 2014-07-07 13:07:55 +0000
@@ -454,9 +454,6 @@
454 def create_parallel_tax_codes(self, cr, uid, ids, context=None):454 def create_parallel_tax_codes(self, cr, uid, ids, context=None):
455 for tax_code in self.browse(cr, SUPERUSER_ID, ids, context):455 for tax_code in self.browse(cr, SUPERUSER_ID, ids, context):
456 for parallel_company in tax_code.company_id.parallel_company_ids:456 for parallel_company in tax_code.company_id.parallel_company_ids:
457 if not tax_code.parent_id:
458 raise orm.except_orm(_('Error'),_('Tax code %s does not have parent')
459 % tax_code.code)
460 existing_ids = self.search(cr, SUPERUSER_ID, [457 existing_ids = self.search(cr, SUPERUSER_ID, [
461 ('code', '=', tax_code.code),458 ('code', '=', tax_code.code),
462 ('company_id', '=', parallel_company.id),459 ('company_id', '=', parallel_company.id),
@@ -465,9 +462,14 @@
465 raise orm.except_orm(_('Error'),462 raise orm.except_orm(_('Error'),
466 _('Tax code %s already exists for company %s')463 _('Tax code %s already exists for company %s')
467 % (tax_code.code, parallel_company.name))464 % (tax_code.code, parallel_company.name))
468 parent_parallel_tax_code_id = self._search_parallel_tax_code(465 if tax_code.parent_id:
469 cr, SUPERUSER_ID, tax_code.parent_id.code, parallel_company,466 parent_parallel_tax_code_id = (
470 context=context)467 self._search_parallel_tax_code(
468 cr, SUPERUSER_ID, tax_code.parent_id.code,
469 parallel_company, context=context)
470 )
471 else:
472 parent_parallel_tax_code_id = False
471 new_id = self.create(cr, SUPERUSER_ID,{473 new_id = self.create(cr, SUPERUSER_ID,{
472 'company_id': parallel_company.id,474 'company_id': parallel_company.id,
473 'parent_id': parent_parallel_tax_code_id,475 'parent_id': parent_parallel_tax_code_id,

Subscribers

People subscribed via source and target branches