summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSomesh Khare <skh@openerp.com>2014-11-21 10:46:35 +0530
committerMartin Trigaux <mat@odoo.com>2015-04-10 12:17:52 +0200
commit39010d38567a4d679cbdb8c0e21cffec6c3bb6b0 (patch)
tree07b4231c93d83fae6b7026e4f9cbac3d9c9c3640
parent2a3ce719bc9ad8e386867ba2019c27a0f49a11b9 (diff)
[FIX] account: wrong amount for tax included
Backport of 8.0 code, rev f61339b Create a new journal item with an tax included, the automatically created tax line had the amount computed as tax excluded. Fixes #3731, opw 618305
-rw-r--r--addons/account/account_move_line.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index e79fde1df8f..9287ed239c4 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -1246,15 +1246,23 @@ class account_move_line(osv.osv):
base_sign = 'base_sign'
tax_sign = 'tax_sign'
tmp_cnt = 0
- for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=True).get('taxes'):
+ for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=False).get('taxes'):
#create the base movement
if tmp_cnt == 0:
if tax[base_code]:
tmp_cnt += 1
- self.write(cr, uid,[result], {
+ if tax_id.price_include:
+ total = tax['price_unit']
+ newvals = {
'tax_code_id': tax[base_code],
- 'tax_amount': tax[base_sign] * abs(total)
- })
+ 'tax_amount': tax[base_sign] * abs(total),
+ }
+ if tax_id.price_include:
+ if tax['price_unit'] < 0:
+ newvals['credit'] = abs(tax['price_unit'])
+ else:
+ newvals['debit'] = tax['price_unit']
+ self.write(cr, uid, [result], newvals, context=context)
else:
data = {
'move_id': vals['move_id'],