summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2013-08-02 14:03:11 +0200
committerMartin Trigaux <mat@openerp.com>2013-08-02 14:03:11 +0200
commit44f7a82281ccdee2dab7f91c9bc2df3c54e2b7f1 (patch)
tree652f9845db7e39db157fa8fb12edfa8b08afa8ae
parent110e74f46f24c768267256d1dc2eedb854fa91db (diff)
[FIX] account_voucher: evaluate move line account with correct precision
This bug may have generated incorrect account_voucher_line when validating a voucher with amount less than 1. This patch will avoid reproducing the problem on new lines but not fix already existing vouchers. To do so apply the following steps: 1. apply this patch 2. do a manual reconciliation of the account.move.lines with amount less than 1 (use the manual reconciliation menu to see every line, included 0-0 lines) 3. execute the following SQL query DELETE FROM account_voucher_line WHERE id IN (SELECT l.id FROM account_voucher_line AS l JOIN account_voucher AS v ON (v.id = l.voucher_id) JOIN account_move_line AS ml ON (l.move_line_id = ml.id) WHERE l.amount = 0 AND v.state = 'draft' AND ml.debit = ml.credit AND ml.credit = 0); that will remove account voucher lines from draft vouchers linked to an empty move lines bzr revid: mat@openerp.com-20130802120311-oh64d47t8x6t1wf9
-rw-r--r--addons/account_voucher/account_voucher.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index d9a3fefbd6a..4f383a1d077 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -1198,7 +1198,7 @@ class account_voucher(osv.osv):
for line in voucher.line_ids:
#create one move line per voucher line where amount is not 0.0
# AND (second part of the clause) only if the original move line was not having debit = credit = 0 (which is a legal value)
- if not line.amount and not (line.move_line_id and not float_compare(line.move_line_id.debit, line.move_line_id.credit, precision_rounding=prec) and not float_compare(line.move_line_id.debit, 0.0, precision_rounding=prec)):
+ if not line.amount and not (line.move_line_id and not float_compare(line.move_line_id.debit, line.move_line_id.credit, precision_digits=prec) and not float_compare(line.move_line_id.debit, 0.0, precision_digits=prec)):
continue
# convert the amount set on the voucher line into the currency of the voucher's company
# this calls res_curreny.compute() with the right context, so that it will take either the rate on the voucher if it is relevant or will use the default behaviour