From 6b852ecbb72a825d7a1417e030e1a3f4de4df14b Mon Sep 17 00:00:00 2001 From: Timon Tschanz Date: Fri, 10 May 2019 15:41:43 +0200 Subject: [PATCH 1/6] [10.0][ADD] l10n_ch_account_reconcile_esr --- l10n_ch_account_reconcile_esr/__init__.py | 1 + l10n_ch_account_reconcile_esr/__manifest__.py | 24 ++++ .../models/__init__.py | 1 + .../models/account_bank_statement_line.py | 111 ++++++++++++++++++ .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 2 + .../readme/USAGE.rst | 3 + .../static/src/js/account_reconciliation.js | 32 +++++ .../static/src/xml/account_reconciliation.xml | 12 ++ .../views/assets.xml | 8 ++ 10 files changed, 195 insertions(+) create mode 100644 l10n_ch_account_reconcile_esr/__init__.py create mode 100644 l10n_ch_account_reconcile_esr/__manifest__.py create mode 100644 l10n_ch_account_reconcile_esr/models/__init__.py create mode 100644 l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py create mode 100644 l10n_ch_account_reconcile_esr/readme/CONTRIBUTORS.rst create mode 100644 l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst create mode 100644 l10n_ch_account_reconcile_esr/readme/USAGE.rst create mode 100644 l10n_ch_account_reconcile_esr/static/src/js/account_reconciliation.js create mode 100644 l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml create mode 100644 l10n_ch_account_reconcile_esr/views/assets.xml diff --git a/l10n_ch_account_reconcile_esr/__init__.py b/l10n_ch_account_reconcile_esr/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/l10n_ch_account_reconcile_esr/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/l10n_ch_account_reconcile_esr/__manifest__.py b/l10n_ch_account_reconcile_esr/__manifest__.py new file mode 100644 index 0000000000..8d28a678c3 --- /dev/null +++ b/l10n_ch_account_reconcile_esr/__manifest__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + 'name': 'Switzerland - ESR account reconcile', + 'version': '10.0.1.0.0', + 'author': "Camptocamp,Odoo Community Association (OCA)", + 'website': 'https://github.com/OCA/l10n-switzerland', + 'license': 'AGPL-3', + 'summary': 'Adds a second automatic reconciliation button,' + ' which is based on the esr', + 'depends': [ + 'account', + 'base_transaction_id', + ], + 'data': [ + 'views/assets.xml', + ], + 'qweb': [ + 'static/src/xml/account_reconciliation.xml', + ], + 'installable': True, + 'auto_install': False, +} diff --git a/l10n_ch_account_reconcile_esr/models/__init__.py b/l10n_ch_account_reconcile_esr/models/__init__.py new file mode 100644 index 0000000000..b625fd6290 --- /dev/null +++ b/l10n_ch_account_reconcile_esr/models/__init__.py @@ -0,0 +1 @@ +from . import account_bank_statement_line diff --git a/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py b/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py new file mode 100644 index 0000000000..895f6fccfe --- /dev/null +++ b/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, api +from odoo.exceptions import UserError + + +class AccountBankStatementLine(models.Model): + _inherit = "account.bank.statement.line" + + @api.multi + def auto_reconcile(self): + # If we don't have esr_reconcile we want the default odoo way + if not self.env.context.get('esr_reconcile'): + return super(AccountBankStatementLine, self). auto_reconcile() + # otherwise use esr reconcile + else: + return self.auto_reconcile_esr() + + @api.multi + def auto_reconcile_esr(self): + """ Reconcile the Bank statement line and acount move line + based on only the esr + + """ + self.ensure_one() + match_recs = self.env['account.move.line'] + + # customized: dropped unneeded params + params = { + 'company_id': self.env.user.company_id.id, + 'account_payable_receivable': ( + self.journal_id.default_credit_account_id.id, + self.journal_id.default_debit_account_id.id + ), + 'partner_id': self.partner_id.id, + 'ref': self.name, + } + # Try to get ESR match + if self.name: + sql_query = self._get_common_sql_query_ignore_partner() + \ + " AND aml.transaction_ref = %(ref)s ORDER BY \ + date_maturity asc, aml.id asc" + self.env.cr.execute(sql_query, params) + match_recs = self.env.cr.dictfetchall() + if len(match_recs) > 1: + return False + # Customizations done. odoo code from here on. + if not match_recs: + return False + + match_recs = self.env['account.move.line'].browse( + [aml.get('id') for aml in match_recs] + ) + # Now reconcile + counterpart_aml_dicts = [] + payment_aml_rec = self.env['account.move.line'] + for aml in match_recs: + if aml.account_id.internal_type == 'liquidity': + payment_aml_rec = (payment_aml_rec | aml) + else: + amount = aml.currency_id \ + and aml.amount_residual_currency or aml.amount_residual + counterpart_aml_dicts.append({ + 'name': aml.name if aml.name != '/' else aml.move_id.name, + 'debit': amount < 0 and -amount or 0, + 'credit': amount > 0 and amount or 0, + 'move_line': aml + }) + + try: + with self._cr.savepoint(): + counterpart = self.process_reconciliation( + counterpart_aml_dicts=counterpart_aml_dicts, + payment_aml_rec=payment_aml_rec + ) + return counterpart + except UserError: + # A configuration / business logic error that makes it impossible + # to auto-reconcile should not be raised + # since automatic reconciliation is just an amenity and the user + # will get the same exception when manually + # reconciling. Other types of exception are (hopefully) + # programmation errors and should cause a stacktrace. + self.invalidate_cache() + self.env['account.move'].invalidate_cache() + self.env['account.move.line'].invalidate_cache() + return False + + def _get_common_sql_query_ignore_partner(self): + """ Selects the account move lines based on account type and company. + + Basequery, returns all lines matching filter clause needs to be added. + """ + acc_type = "acc.internal_type IN ('payable', 'receivable')" if ( + self.partner_id or False + ) else "acc.reconcile = true" + account_clause = '' + if self.journal_id.default_credit_account_id and \ + self.journal_id.default_debit_account_id: + account_clause = "(aml.statement_id IS NULL AND aml.account_id IN \ + %(account_payable_receivable)s AND aml.payment_id IS NOT NULL) OR" + query = """ + SELECT aml.id + FROM account_move_line aml + JOIN account_account acc ON acc.id = aml.account_id + WHERE aml.company_id = %(company_id)s + AND ({0} ( {1} AND aml.reconciled = false)) + """ + return query.format(account_clause, acc_type) diff --git a/l10n_ch_account_reconcile_esr/readme/CONTRIBUTORS.rst b/l10n_ch_account_reconcile_esr/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..5a2b302925 --- /dev/null +++ b/l10n_ch_account_reconcile_esr/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +Timon Tschanz diff --git a/l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst b/l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..3e4b5ce50b --- /dev/null +++ b/l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This addon adds a second auto reconciliation button, which reconciles statement lines +only based on the ESR. This should allow for more acurate matching, though we probably match a bit less. diff --git a/l10n_ch_account_reconcile_esr/readme/USAGE.rst b/l10n_ch_account_reconcile_esr/readme/USAGE.rst new file mode 100644 index 0000000000..a2f8e435cd --- /dev/null +++ b/l10n_ch_account_reconcile_esr/readme/USAGE.rst @@ -0,0 +1,3 @@ +To use this module following steps are required: +1. Go to the Bank Statement reconciliation view +2. Press the "Automatic ESR reconciliation" button diff --git a/l10n_ch_account_reconcile_esr/static/src/js/account_reconciliation.js b/l10n_ch_account_reconcile_esr/static/src/js/account_reconciliation.js new file mode 100644 index 0000000000..06745210f0 --- /dev/null +++ b/l10n_ch_account_reconcile_esr/static/src/js/account_reconciliation.js @@ -0,0 +1,32 @@ +odoo.define('specific_account.esr_reconciliation', function (require) { +"use strict"; + +var AccountReconciliation = require('account.reconciliation'); +var core = require('web.core'); + + +// Add a second button to reconcilation widget which only reconciles based on esr. +AccountReconciliation.bankStatementReconciliation.include({ + start: function() { + var self = this; + return $.when(this._super()).then(function(){ + self.$el.find('.js_esr_reconciliation').click(function() { + self.model_bank_statement_line + .call("reconciliation_widget_auto_reconcile", + [self.lines || undefined, self.num_already_reconciled_lines], + {'context': {'esr_reconcile': true}} + ) + .then(function(data){ + self.serverPreprocessResultHandler(data); + }) + .then(function(){ + self.$('.js_esr_reconciliation').hide(); + return self.display_reconciliation_propositions(); + }); + + }); + + }); + }, +}); +}); diff --git a/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml b/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml new file mode 100644 index 0000000000..434b58926e --- /dev/null +++ b/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/l10n_ch_account_reconcile_esr/views/assets.xml b/l10n_ch_account_reconcile_esr/views/assets.xml new file mode 100644 index 0000000000..5b90d66a90 --- /dev/null +++ b/l10n_ch_account_reconcile_esr/views/assets.xml @@ -0,0 +1,8 @@ + + + + From 01e014dcd0a16fdd2daa6f61ebe7fbc861bbd6a7 Mon Sep 17 00:00:00 2001 From: Timon Tschanz Date: Mon, 13 May 2019 17:07:25 +0200 Subject: [PATCH 2/6] Hide original button --- .../static/src/xml/account_reconciliation.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml b/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml index 434b58926e..38b8c0c1cf 100644 --- a/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml +++ b/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml @@ -6,7 +6,10 @@ - + + + + display: none; From 5b53e4943b876f933049b3f30e1e1c7a2bcfa155 Mon Sep 17 00:00:00 2001 From: Timon Tschanz Date: Mon, 13 May 2019 17:07:40 +0200 Subject: [PATCH 3/6] Add translations --- l10n_ch_account_reconcile_esr/i18n/de.po | 43 +++++++++++++++++++ l10n_ch_account_reconcile_esr/i18n/fr.po | 43 +++++++++++++++++++ l10n_ch_account_reconcile_esr/i18n/it.po | 43 +++++++++++++++++++ .../i18n/l10n_ch_account_reconcile_esr.pot | 43 +++++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 l10n_ch_account_reconcile_esr/i18n/de.po create mode 100644 l10n_ch_account_reconcile_esr/i18n/fr.po create mode 100644 l10n_ch_account_reconcile_esr/i18n/it.po create mode 100644 l10n_ch_account_reconcile_esr/i18n/l10n_ch_account_reconcile_esr.pot diff --git a/l10n_ch_account_reconcile_esr/i18n/de.po b/l10n_ch_account_reconcile_esr/i18n/de.po new file mode 100644 index 0000000000..4f44c9b9a2 --- /dev/null +++ b/l10n_ch_account_reconcile_esr/i18n/de.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_account_reconcile_esr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-05-13 14:39+0000\n" +"PO-Revision-Date: 2019-05-13 16:41+0200\n" +"Last-Translator: Timon Tschanz \n" +"Language-Team: German\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: de\n" + +#. module: l10n_ch_account_reconcile_esr +#: model:ir.model,name:l10n_ch_account_reconcile_esr.model_account_bank_statement_line +msgid "Bank Statement Line" +msgstr "Kontoauszugzeile" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "ESR reconciliation" +msgstr "ESR Ausgleich" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "Let odoo try to reconcile entries for the user using esr refs" +msgstr "Versucht zeilen basierent auf der ESR nummer auszugleichen" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:12 +#, python-format +msgid "display: none;" +msgstr "" diff --git a/l10n_ch_account_reconcile_esr/i18n/fr.po b/l10n_ch_account_reconcile_esr/i18n/fr.po new file mode 100644 index 0000000000..785c95ad47 --- /dev/null +++ b/l10n_ch_account_reconcile_esr/i18n/fr.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_account_reconcile_esr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-05-13 14:39+0000\n" +"PO-Revision-Date: 2019-05-13 16:41+0200\n" +"Last-Translator: Timon Tschanz \n" +"Language-Team: French\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Language: fr\n" + +#. module: l10n_ch_account_reconcile_esr +#: model:ir.model,name:l10n_ch_account_reconcile_esr.model_account_bank_statement_line +msgid "Bank Statement Line" +msgstr "Ligne de relevé bancaire" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "ESR reconciliation" +msgstr "Lettrage BVR" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "Let odoo try to reconcile entries for the user using esr refs" +msgstr "Laisser Odoo essayer de lettrer les entrées pour l'utilisateur avec les références BVR" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:12 +#, python-format +msgid "display: none;" +msgstr "display: none;" diff --git a/l10n_ch_account_reconcile_esr/i18n/it.po b/l10n_ch_account_reconcile_esr/i18n/it.po new file mode 100644 index 0000000000..3fa877424d --- /dev/null +++ b/l10n_ch_account_reconcile_esr/i18n/it.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_account_reconcile_esr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-05-13 14:39+0000\n" +"PO-Revision-Date: 2019-05-13 16:41+0200\n" +"Last-Translator: Timon Tschanz \n" +"Language-Team: Italian\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: it\n" + +#. module: l10n_ch_account_reconcile_esr +#: model:ir.model,name:l10n_ch_account_reconcile_esr.model_account_bank_statement_line +msgid "Bank Statement Line" +msgstr "Linea estratto conto" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "ESR reconciliation" +msgstr "Riconciliazione PVR" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "Let odoo try to reconcile entries for the user using esr refs" +msgstr "" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:12 +#, python-format +msgid "display: none;" +msgstr "display: none;" diff --git a/l10n_ch_account_reconcile_esr/i18n/l10n_ch_account_reconcile_esr.pot b/l10n_ch_account_reconcile_esr/i18n/l10n_ch_account_reconcile_esr.pot new file mode 100644 index 0000000000..be3972ef6a --- /dev/null +++ b/l10n_ch_account_reconcile_esr/i18n/l10n_ch_account_reconcile_esr.pot @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_ch_account_reconcile_esr +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-05-13 14:39+0000\n" +"PO-Revision-Date: 2019-05-13 14:39+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_ch_account_reconcile_esr +#: model:ir.model,name:l10n_ch_account_reconcile_esr.model_account_bank_statement_line +msgid "Bank Statement Line" +msgstr "" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "ESR reconciliation" +msgstr "" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:9 +#, python-format +msgid "Let odoo try to reconcile entries for the user using esr refs" +msgstr "" + +#. module: l10n_ch_account_reconcile_esr +#. openerp-web +#: code:addons/l10n_ch_account_reconcile_esr/static/src/xml/account_reconciliation.xml:12 +#, python-format +msgid "display: none;" +msgstr "" + From 018336c6997d12501236f9d26fc2d8d465f80e83 Mon Sep 17 00:00:00 2001 From: Timon Tschanz Date: Mon, 13 May 2019 17:09:58 +0200 Subject: [PATCH 4/6] update description after change of behaviour --- l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst b/l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst index 3e4b5ce50b..1bf0740712 100644 --- a/l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst +++ b/l10n_ch_account_reconcile_esr/readme/DESCRIPTION.rst @@ -1,2 +1,2 @@ -This addon adds a second auto reconciliation button, which reconciles statement lines -only based on the ESR. This should allow for more acurate matching, though we probably match a bit less. +This addon adds a new auto reconciliation button, which reconciles statement lines +only based on the ESR and hides the original one. This should allow for more acurate matching, though we probably match a bit less. From efad527acc6f166dd55de54183fa5c8e9583f227 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Fri, 14 Jun 2019 11:51:09 +0200 Subject: [PATCH 5/6] [FIX] prevent reconciliation if transaction_ref and ref in bank statement line are null --- .../models/account_bank_statement_line.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py b/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py index 895f6fccfe..51a63384ff 100644 --- a/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py +++ b/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py @@ -40,7 +40,8 @@ def auto_reconcile_esr(self): # Try to get ESR match if self.name: sql_query = self._get_common_sql_query_ignore_partner() + \ - " AND aml.transaction_ref = %(ref)s ORDER BY \ + " AND aml.transaction_ref = %(ref)s" \ + " AND aml.transaction_ref is not null ORDER BY \ date_maturity asc, aml.id asc" self.env.cr.execute(sql_query, params) match_recs = self.env.cr.dictfetchall() From 094302a8da64975c296f3ab3e2f5e5b3bbb090e9 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Tue, 18 Jun 2019 16:43:02 +0200 Subject: [PATCH 6/6] [FIX] match only on correct amount --- .../models/account_bank_statement_line.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py b/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py index 51a63384ff..2a7e61c9a2 100644 --- a/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py +++ b/l10n_ch_account_reconcile_esr/models/account_bank_statement_line.py @@ -36,13 +36,15 @@ def auto_reconcile_esr(self): ), 'partner_id': self.partner_id.id, 'ref': self.name, + 'amount': self.amount } # Try to get ESR match if self.name: sql_query = self._get_common_sql_query_ignore_partner() + \ " AND aml.transaction_ref = %(ref)s" \ - " AND aml.transaction_ref is not null ORDER BY \ - date_maturity asc, aml.id asc" + " AND aml.transaction_ref is not null" \ + " AND aml.amount_residual = %(amount)s ORDER BY" \ + " date_maturity asc, aml.id asc" self.env.cr.execute(sql_query, params) match_recs = self.env.cr.dictfetchall() if len(match_recs) > 1: @@ -61,8 +63,7 @@ def auto_reconcile_esr(self): if aml.account_id.internal_type == 'liquidity': payment_aml_rec = (payment_aml_rec | aml) else: - amount = aml.currency_id \ - and aml.amount_residual_currency or aml.amount_residual + amount = self.amount counterpart_aml_dicts.append({ 'name': aml.name if aml.name != '/' else aml.move_id.name, 'debit': amount < 0 and -amount or 0,