From 5a1e5aa4294cbb375e86636e69963286b56215a5 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 3 Oct 2017 15:37:24 +0200 Subject: [PATCH] [FIX] account: payment communication - Set up a journal which only accepts SEPA payments - Import a CAMT file which contains a statement containing: No "Ustrd" data A "AddtlNtryInf" description longer than 140 characters - Reconcile the bank statement A contrain is raised because the communication of the SEPA payment is longer than 140 characters. From commit https://github.com/odoo/enterprise/commit/ff84f8b7, "AddtlNtryInf" is used if "Ustrd" is empty. However, "AddtlNtryInf" and "Ustrd" do not have the same restrictions. "Ustrd" can have a maximum of 140 characters, while "AddtlNtryInf" can have a maximum of 500 characters. opw-772009 --- addons/account/models/account_bank_statement.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index b272de830a7..15fa128cb30 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -830,6 +830,9 @@ class AccountBankStatementLine(models.Model): } st_line.process_reconciliation(new_aml_dicts=[vals]) + def _get_communication(self, payment_method_id): + return self.name or '' + def process_reconciliation(self, counterpart_aml_dicts=None, payment_aml_rec=None, new_aml_dicts=None): """ Match statement lines with existing payments (eg. checks) and/or payables/receivables (eg. invoices and refunds) and/or new move lines (eg. write-offs). If any new journal item needs to be created (via new_aml_dicts or counterpart_aml_dicts), a new journal entry will be created and will contain those @@ -928,7 +931,7 @@ class AccountBankStatementLine(models.Model): 'state': 'reconciled', 'currency_id': currency.id, 'amount': abs(total), - 'communication': self.name or '', + 'communication': self._get_communication(payment_methods[0] if payment_methods else False), 'name': self.statement_id.name, })