← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~elbati/ocb-addons/7.0_fix_1181291_elbati into lp:ocb-addons

 

You have been requested to review the proposed merge of lp:~elbati/ocb-addons/7.0_fix_1181291_elbati into lp:ocb-addons.

For more details, see:
https://code.launchpad.net/~elbati/ocb-addons/7.0_fix_1181291_elbati/+merge/169352



-- 
https://code.launchpad.net/~elbati/ocb-addons/7.0_fix_1181291_elbati/+merge/169352
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~elbati/ocb-addons/7.0_fix_1181291_elbati into lp:ocb-addons.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2013-08-21 12:17:14 +0000
+++ account_voucher/account_voucher.py	2013-11-07 18:21:09 +0000
@@ -1048,7 +1048,8 @@
                 'period_id': voucher.period_id.id,
                 'partner_id': voucher.partner_id.id,
                 'currency_id': company_currency <> current_currency and  current_currency or False,
-                'amount_currency': company_currency <> current_currency and sign * voucher.amount or 0.0,
+                'amount_currency': (sign * abs(voucher.amount)
+                    if company_currency != current_currency else 0.0),
                 'date': voucher.date,
                 'date_maturity': voucher.date_due
             }
@@ -1268,8 +1269,7 @@
                         # 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:
-                    sign = voucher.type in ('payment', 'purchase') and -1 or 1
-                    foreign_currency_diff = sign * line.move_line_id.amount_residual_currency + amount_currency
+                    foreign_currency_diff = (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)