[FIX] account_voucher: there is no reason to not post currency difference entry at each full reconciliation, whatever the voucher and the line currencies

bzr revid: qdp-launchpad@openerp.com-20130507145427-39w05wwrp1vylb6k
This commit is contained in:
Quentin (OpenERP) 2013-05-07 16:54:27 +02:00
commit bc95557a88
2 changed files with 4 additions and 3 deletions

View File

@ -1226,7 +1226,7 @@ class account_voucher(osv.osv):
# if the rate is specified on the voucher, it will be used thanks to the special keys in the context
# otherwise we use the rates of the system
amount_currency = currency_obj.compute(cr, uid, company_currency, line.move_line_id.currency_id.id, move_line['debit']-move_line['credit'], context=ctx)
if line.amount == line.amount_unreconciled and line.move_line_id.currency_id.id == voucher_currency:
if line.amount == line.amount_unreconciled:
sign = voucher.type in ('payment', 'purchase') and -1 or 1
foreign_currency_diff = sign * line.move_line_id.amount_residual_currency + amount_currency

View File

@ -161,7 +161,7 @@
-
I check that the debtor account has 1 new line with -298.78 as amount_currency columns and 149.39 of credit and currency is CAD.
-
I check that my currency rate difference is correct. 0 in debit with no amount_currency
I check that my currency rate difference is correct. 0 in debit with 98.78 CAD as amount_currency
-
I check that my writeoff is correct. 11.05 credit and -13.26 amount_currency
-
@ -176,7 +176,8 @@
elif move_line.amount_currency == -298.78:
assert move_line.credit == 149.39, "Debtor account has wrong entry."
elif move_line.debit == 0.00 and move_line.credit == 0.00:
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
assert move_line.amount_currency == 98.78, "Incorrect Currency Difference, got %s as amount_currency (expected 98.78)." % (move_line.amount_currency)
assert move_line.currency_id.id == ref('base.CAD'), "Incorrect Currency Difference, got %s (expected 'CAD')" % (move_line.currency_id.name)
elif move_line.credit == 10.61:
assert move_line.amount_currency == -13.26, "Writeoff amount is wrong."
else: