Priyesh (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-50878-pso into 
lp:openobject-addons/6.0.

Requested reviews:
  nel (nel-tinyerp)
Related bugs:
  Bug #896377 in OpenERP Addons: "journal entry with tax included in price: 
wrong base amount"
  https://bugs.launchpad.net/openobject-addons/+bug/896377

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-50878-pso/+merge/84459

Hello,

To reproduce the issue:

1. Configure a tax included in price with amount 0.2
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

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-50878-pso/+merge/84459
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-50878-pso.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2011-11-22 10:49:26 +0000
+++ account/account_move_line.py	2011-12-05 11:39:35 +0000
@@ -1319,7 +1319,9 @@
                         tmp_cnt += 1
                         self.write(cr, uid,[result], {
                             'tax_code_id': tax[base_code],
-                            'tax_amount': tax[base_sign] * abs(total)
+                            'tax_amount': tax[base_sign] * abs(tax['price_unit']),
+                            'credit': tax['price_unit']<0 and -tax['price_unit'] or 0.0,
+                            'debit': tax['price_unit']>0 and tax['price_unit'] or 0.0,
                         })
                 else:
                     data = {
@@ -1332,10 +1334,10 @@
                         'ref': vals.get('ref',False),
                         'account_tax_id': False,
                         'tax_code_id': tax[base_code],
-                        'tax_amount': tax[base_sign] * abs(total),
+                        'tax_amount': tax[base_sign] * abs(tax['price_unit']),
                         'account_id': vals['account_id'],
-                        'credit': 0.0,
-                        'debit': 0.0,
+                        'credit': tax['price_unit']<0 and -tax['price_unit'] or 0.0,
+                        'debit': tax['price_unit']>0 and tax['price_unit'] or 0.0,
                     }
                     if data['tax_code_id']:
                         self.create(cr, uid, data, context)

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to