diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index b4ccea8ba20..4a9c1127410 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -20,6 +20,7 @@ ############################################################################## from openerp.osv import fields, osv +from openerp.tools import float_is_zero from openerp.tools.translate import _ import openerp.addons.decimal_precision as dp from openerp.report import report_sxw @@ -793,8 +794,13 @@ class account_bank_statement_line(osv.osv): if mv_line_dict.get('counterpart_move_line_id'): #post an account line that use the same currency rate than the counterpart (to balance the account) and post the difference in another line ctx['date'] = mv_line.date - debit_at_old_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['debit'], context=ctx) - credit_at_old_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['credit'], context=ctx) + if mv_line.currency_id.id == mv_line_dict['currency_id'] \ + and float_is_zero(mv_line.amount_currency - abs(mv_line_dict['amount_currency']), precision_rounding=mv_line.currency_id.rounding): + debit_at_old_rate = mv_line.credit + credit_at_old_rate = mv_line.debit + else: + debit_at_old_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['debit'], context=ctx) + credit_at_old_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['credit'], context=ctx) mv_line_dict['credit'] = credit_at_old_rate mv_line_dict['debit'] = debit_at_old_rate if debit_at_old_rate - debit_at_current_rate: