Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions account_ebics/models/ebics_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,19 @@ def _split_camt(self, res):
message = self.env._("No bank account number found.")
res["notifications"].append({"type": "error", "message": message})
continue
currency_code = stmt.xpath(
"ns:Acct/ns:Ccy/text() | ns:Bal/ns:Amt/@Ccy", namespaces=ns
)[0]
# camt.054 notifications usually have neither Acct/Ccy nor Bal,
# hence fall back on the currency of the entries
currency_codes = stmt.xpath(
"ns:Acct/ns:Ccy/text() | ns:Bal/ns:Amt/@Ccy | ns:Ntry/ns:Amt/@Ccy",
namespaces=ns,
)
if not currency_codes:
message = self.env._(
"No currency found for Account Number %(nr)s.", nr=acc_number
)
res["notifications"].append({"type": "error", "message": message})
continue
currency_code = currency_codes[0]
# some banks (e.g. COMMERZBANK) add the currency as the last 3 digits
# of the bank account number hence we need to remove this since otherwise
# the journal matching logic fails
Expand Down