Ravish(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1007487-rmu into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1007487 in OpenERP Addons: "Can't pay foreign currency supplier invoices 
with foreign currency vouchers"
  https://bugs.launchpad.net/openobject-addons/+bug/1007487

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1007487-rmu/+merge/115332

Hello,

 When you Create a new supplier invoice with currency = USD and date = yesterday

 - Click 'pay invoice'.
 - Validate the voucher.

 The invoice balance is 200 and it is not paid and also generated journal items 
are wrong.

 With this fix those problem will solved.

 Thanks..!!
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1007487-rmu/+merge/115332
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1007487-rmu.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2012-06-26 14:02:30 +0000
+++ account_voucher/account_voucher.py	2012-07-17 12:53:28 +0000
@@ -1050,6 +1050,8 @@
                 currency_rate_difference = line.move_line_id.amount_residual - amount
             else:
                 currency_rate_difference = 0.0
+            if voucher_brw.type in ('purchase', 'payment'):
+                currency_rate_difference = -1 * currency_rate_difference
             move_line = {
                 'journal_id': voucher_brw.journal_id.id,
                 'period_id': voucher_brw.period_id.id,
@@ -1108,7 +1110,7 @@
                         # otherwise we use the rates of the system (giving the voucher date in the context)
                         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:
-                    foreign_currency_diff = line.move_line_id.amount_residual_currency + amount_currency
+                    foreign_currency_diff = abs(line.move_line_id.amount_residual_currency) - abs(amount_currency)
 
             move_line['amount_currency'] = amount_currency
             voucher_line = move_line_obj.create(cr, uid, move_line)

_______________________________________________
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