[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
This commit is contained in:
Nicolas Martinelli
2017-10-10 11:15:18 +02:00
parent 0e65962a16
commit 5a1e5aa429
@@ -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,
})