From 9516bad3cb9ec82fed666c818a37614478df982c Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Wed, 25 May 2016 10:55:39 +0200 Subject: [PATCH] [FIX] account: don't write the foreign currency on writeoff when several secondary currencies are involved --- addons/account/models/account_move.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 5cc899b9fad..285e8e6e843 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -830,7 +830,14 @@ class AccountMoveLine(models.Model): #if writeoff_acc_id specified, then create write-off move with value the remaining amount from move in self if writeoff_acc_id and writeoff_journal_id and remaining_moves: - writeoff_to_reconcile = remaining_moves._create_writeoff({'account_id': writeoff_acc_id.id, 'journal_id': writeoff_journal_id.id}) + all_aml_share_same_currency = all([x.currency_id == self[0].currency_id for x in self]) + writeoff_vals = { + 'account_id': writeoff_acc_id.id, + 'journal_id': writeoff_journal_id.id + } + if not all_aml_share_same_currency: + writeoff_vals['amount_currency'] = False + writeoff_to_reconcile = remaining_moves._create_writeoff(writeoff_vals) #add writeoff line to reconcile algo and finish the reconciliation remaining_moves = (remaining_moves + writeoff_to_reconcile).auto_reconcile_lines()