Merge lp:~openerp-dev/openobject-addons/6.0-opw-50878-pso into lp:openobject-addons/6.0

Proposed by Priyesh (OpenERP) on 2011-12-05
Status: Rejected
Rejected by: nel on 2012-02-07
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-50878-pso
Merge into: lp:openobject-addons/6.0
Diff against target: 28 lines (+6/-4)
1 file modified
account/account_move_line.py (+6/-4)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-50878-pso
Reviewer Review Type Date Requested Status
nel (community) 2011-12-05 Disapprove on 2012-02-27
Naresh(OpenERP) (community) Approve on 2012-01-24
Review via email: mp+84459@code.launchpad.net

Description of the change

Hello,

To reproduce the issue:

1. Configure a tax included in price with amount 0.2 also assign tax invoice tax accounts,account tax code
2. Go to accounting -> journal entries -> journal entries
3. Create a move line with credit = 100 and tax = the previously created tax
4. Save

You get 2 lines:
tax line with credit = 16.67 (correct)
base line with credit = 100 (wrong)

base line should be 83.33

Can you please share your views ?

Thanks,
Priyesh

To post a comment you must log in.
review: Approve
nel (nel-tinyerp) wrote :

This will give a strange behavior to the system. Suppose a user, that doesn't know about this feature, enters a value 100(like in your example). This user expects the system to keep this value and not to calculate it. So that's why, we suppose that accountant or users that create vouchers basing on tax included, should enter right amounts in all cases.
We prefer avoid making such calculation on fillable fields because it could cause many problems.

review: Disapprove

Unmerged revisions

4945. By Lorenzo Battistini - Agile BG - Domsense on 2011-12-05

[IMP] account: Improved create method of move line to create the correct entries(case:50878)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_move_line.py'
2--- account/account_move_line.py 2011-11-22 10:49:26 +0000
3+++ account/account_move_line.py 2011-12-05 11:39:35 +0000
4@@ -1319,7 +1319,9 @@
5 tmp_cnt += 1
6 self.write(cr, uid,[result], {
7 'tax_code_id': tax[base_code],
8- 'tax_amount': tax[base_sign] * abs(total)
9+ 'tax_amount': tax[base_sign] * abs(tax['price_unit']),
10+ 'credit': tax['price_unit']<0 and -tax['price_unit'] or 0.0,
11+ 'debit': tax['price_unit']>0 and tax['price_unit'] or 0.0,
12 })
13 else:
14 data = {
15@@ -1332,10 +1334,10 @@
16 'ref': vals.get('ref',False),
17 'account_tax_id': False,
18 'tax_code_id': tax[base_code],
19- 'tax_amount': tax[base_sign] * abs(total),
20+ 'tax_amount': tax[base_sign] * abs(tax['price_unit']),
21 'account_id': vals['account_id'],
22- 'credit': 0.0,
23- 'debit': 0.0,
24+ 'credit': tax['price_unit']<0 and -tax['price_unit'] or 0.0,
25+ 'debit': tax['price_unit']>0 and tax['price_unit'] or 0.0,
26 }
27 if data['tax_code_id']:
28 self.create(cr, uid, data, context)