account_ebics 16.0 : add support for CFONB

This commit is contained in:
Luc De Meyer 2023-08-03 23:42:58 +02:00
parent 696a744773
commit 95acd0dd70

View File

@ -46,15 +46,35 @@ class AccountStatementImport(models.TransientModel):
show days without transactions via the bank statement list view. show days without transactions via the bank statement list view.
""" """
if self.env.context.get("active_model") == "ebics.file": if self.env.context.get("active_model") == "ebics.file":
messages = []
transactions = False transactions = False
for st_vals in stmts_vals: for st_vals in stmts_vals:
statement_ids = result["statement_ids"][:]
self._set_statement_name(st_vals)
if st_vals.get("transactions"): if st_vals.get("transactions"):
transactions = True transactions = True
break super()._create_bank_statements(stmts_vals, result)
if not transactions: if result["statement_ids"] == statement_ids:
message = _("This file doesn't contain any transaction.") # no statement has been created, this is the case
st_line_ids = [] # when all transactions have been imported already
notifications = {"type": "warning", "message": message, "details": ""} messages.append(
return st_line_ids, [notifications] _(
"Statement %(st_name)s dated %(date)s "
"has already been imported.",
st_name=st_vals["name"],
date=st_vals["date"].strftime("%Y-%m-%d"),
)
)
return super()._create_bank_statements(stmts_vals, result) if not transactions:
messages.append(_("This file doesn't contain any transaction."))
if messages:
result["notifications"].append(
{"type": "warning", "message": "\n".join(messages)}
)
return
def _set_statement_name(self, st_vals):
"""
Inherit this method to set your own statement naming policy.
"""