From 8d9f0c8d941565f3831adef4c12b94cb97ed8be9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 8 May 2017 14:05:37 +0200 Subject: [PATCH] [FIX] account: double journal entry in reconciliation - Create a bank statement for Partner A, with one line of 1000 EUR - Open the reconciliation widget (click on "Reconcile") - Using another browser, open the same reconciliation widget - Create an entry for the opened balance in browser 1, click on "Reconcile" - Create an entry for the opened balance in browser 2, click on "Reconcile" The entries are created twice, no check is performed to verify that the statement line is already reconciled. opw-741824 --- addons/account/i18n/account.pot | 6 ++++++ addons/account/models/account_bank_statement.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 7d04aa32e6d..a5336193698 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -849,6 +849,12 @@ msgstr "" msgid "A selected move line was already reconciled." msgstr "" +#. module: account +#: code:addons/account/models/account_bank_statement.py:883 +#, python-format +msgid "A selected statement line was already reconciled with an account move." +msgstr "" + #. module: account #: code:addons/account/models/account_bank_statement.py:218 #, python-format diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 8e424aff77b..157fdbedf4a 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -879,6 +879,8 @@ class AccountBankStatementLine(models.Model): if aml_dict.get('tax_ids') and aml_dict['tax_ids'] and isinstance(aml_dict['tax_ids'][0], (int, long)): # Transform the value in the format required for One2many and Many2many fields aml_dict['tax_ids'] = map(lambda id: (4, id, None), aml_dict['tax_ids']) + if any(line.journal_entry_ids for line in self): + raise UserError(_('A selected statement line was already reconciled with an account move.')) # Fully reconciled moves are just linked to the bank statement total = self.amount