From 6b1bff4ee9a0170adeef6af50139d1c8e04403d0 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 16 Jun 2016 13:55:36 +0200 Subject: [PATCH] [FIX] account: fix condition to create exchange_rate_entries, in some case we don't want to create one Typically when sum(debit) = sum(credit) and sum(amount_currency) = 0 --- addons/account/models/account_move.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index bf898d17ff6..1375c02e574 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1370,6 +1370,9 @@ class AccountPartialReconcile(models.Model): partial_rec_set[x] = None #then, if the total debit and credit are equal, or the total amount in currency is 0, the reconciliation is full 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): + # If both condition are satisfied, no need to create exchange rate entry + if float_is_zero(total_amount_currency, precision_rounding=currency.rounding) and float_compare(total_debit, total_credit, precision_rounding=currency.rounding) == 0: + return res #eventually create a journal entry to book the difference due to foreign currency's exchange rate that fluctuates aml_id, partial_rec_id = partial_rec.create_exchange_rate_entry(aml_to_balance, total_debit - total_credit, total_amount_currency, currency, maxdate) return res