Nehal Panchal (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-575865-nep into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575865-nep/+merge/111360

Hello,

Cannot pay foreign currency invoices with foreign currency vouchers.

This fixes the issue.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-575865-nep/+merge/111360
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-575865-nep.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2012-03-30 11:07:16 +0000
+++ account_voucher/account_voucher.py	2012-06-21 09:15:03 +0000
@@ -1023,6 +1023,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,
@@ -1081,7 +1083,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