From cbc0dace389345a5749fd6841befc1ad18f178a8 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 15 Apr 2016 15:40:54 +0200 Subject: [PATCH] [FIX] account: currency round amounts for exchange rate difference The method `create_exchange_rate_entry` is called either if one of the two parameter `amount_diff` or `diff_in_currency` is not equal to 0.0 (or, near to zero, `float_is_zero`): ``` if currency and aml_to_balance \ and (float_is_zero(total_amount_currency, precision_rounding=currency.rounding) \ or float_compare(total_debit, total_credit, precision_rounding=currency.rounding) == 0): ``` Nevertheless, the method is called with the amounts not rounded, and, therefore, one could be considered to 0.0 (if closed to 0.0) but not be exactly equal to 0.00, and it should therefore be rounded before the entries creation. opw-673854 --- addons/account/models/account_move.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index c1efa64aafe..01a3bcf0c1e 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1232,6 +1232,8 @@ class AccountPartialReconcile(models.Model): if move_date > rec.company_id.fiscalyear_lock_date: move_vals['date'] = move_date move = rec.env['account.move'].create(move_vals) + amount_diff = rec.company_id.currency_id.round(amount_diff) + diff_in_currency = currency.round(diff_in_currency) line_to_reconcile = rec.env['account.move.line'].with_context(check_move_validity=False).create({ 'name': _('Currency exchange rate difference'), 'debit': amount_diff < 0 and -amount_diff or 0.0,