mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-10-17 08:19:10 +00:00
[FIX] account_ebics: IndexError in _split_camt for camt.054
Fix IndexError in _split_camt when camt.054 has no currency at statement level. This commit implements the following changes: - discard statements without entries before attempting currency extraction - fall back to Ntry/Amt/@Ccy for camt.054 when Acct/Ccy and Bal/Amt/@Ccy are absent
This commit is contained in:
1 parent
cd321196bb
commit
68914789b8
3 files changed
+16
-10
No files matched your search
@@ -15,7 +15,7 @@ Available addons
|
|||||||
----------------
|
----------------
|
||||||
addon | version | maintainers | summary
|
addon | version | maintainers | summary
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
[account_ebics](account_ebics/) | 19.0.1.3.0 | | Download bank statements and upload payment files directly from Odoo, using the European EBICS standard
|
[account_ebics](account_ebics/) | 19.0.1.3.1 | | Download bank statements and upload payment files directly from Odoo, using the European EBICS standard
|
||||||
[account_ebics_batch](account_ebics_batch/) | 19.0.1.0.1 | | Download and process your EBICS files automatically, on a schedule
|
[account_ebics_batch](account_ebics_batch/) | 19.0.1.0.1 | | Download and process your EBICS files automatically, on a schedule
|
||||||
[account_ebics_batch_payment](account_ebics_batch_payment/) | 19.0.1.3.0 | | Send an Odoo Enterprise batch payment to the bank over EBICS
|
[account_ebics_batch_payment](account_ebics_batch_payment/) | 19.0.1.3.0 | | Send an Odoo Enterprise batch payment to the bank over EBICS
|
||||||
[account_ebics_oe](account_ebics_oe/) | 19.0.1.0.0 | | Place the EBICS menus in the Odoo Enterprise accounting application
|
[account_ebics_oe](account_ebics_oe/) | 19.0.1.0.0 | | Place the EBICS menus in the Odoo Enterprise accounting application
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"name": "EBICS Banking Protocol",
|
"name": "EBICS Banking Protocol",
|
||||||
"summary": "Download bank statements and upload payment "
|
"summary": "Download bank statements and upload payment "
|
||||||
"files directly from Odoo, using the European EBICS standard",
|
"files directly from Odoo, using the European EBICS standard",
|
||||||
"version": "19.0.1.3.0",
|
"version": "19.0.1.3.1",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"author": "Noviat",
|
"author": "Noviat",
|
||||||
"website": "https://www.noviat.com/",
|
"website": "https://www.noviat.com/",
|
||||||
|
|||||||
@@ -590,9 +590,21 @@ class EbicsFile(models.Model):
|
|||||||
message = self.env._("No bank account number found.")
|
message = self.env._("No bank account number found.")
|
||||||
res["notifications"].append({"type": "error", "message": message})
|
res["notifications"].append({"type": "error", "message": message})
|
||||||
continue
|
continue
|
||||||
currency_code = stmt.xpath(
|
if not stmt.findall("ns:Ntry", ns):
|
||||||
|
continue
|
||||||
|
currency_codes = stmt.xpath(
|
||||||
"ns:Acct/ns:Ccy/text() | ns:Bal/ns:Amt/@Ccy", namespaces=ns
|
"ns:Acct/ns:Ccy/text() | ns:Bal/ns:Amt/@Ccy", namespaces=ns
|
||||||
)[0]
|
)
|
||||||
|
if not currency_codes and camt_variant == "054":
|
||||||
|
currency_codes = stmt.xpath("ns:Ntry/ns:Amt/@Ccy", namespaces=ns)
|
||||||
|
if not currency_codes:
|
||||||
|
message = self.env._(
|
||||||
|
"No currency found in statement for Account Number %(nbr)s.",
|
||||||
|
nbr=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
|
# 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
|
# of the bank account number hence we need to remove this since otherwise
|
||||||
# the journal matching logic fails
|
# the journal matching logic fails
|
||||||
@@ -600,15 +612,9 @@ class EbicsFile(models.Model):
|
|||||||
acc_number = acc_number[:-3]
|
acc_number = acc_number[:-3]
|
||||||
|
|
||||||
root_new = deepcopy(root)
|
root_new = deepcopy(root)
|
||||||
entries = False
|
|
||||||
for j, el in enumerate(root_new[0].findall(f"ns:{camt_tag}", ns)):
|
for j, el in enumerate(root_new[0].findall(f"ns:{camt_tag}", ns)):
|
||||||
if j != i:
|
if j != i:
|
||||||
el.getparent().remove(el)
|
el.getparent().remove(el)
|
||||||
else:
|
|
||||||
entries = el.findall("ns:Ntry", ns)
|
|
||||||
if not entries:
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
currency, journal = self._lookup_journal(res, acc_number, currency_code)
|
currency, journal = self._lookup_journal(res, acc_number, currency_code)
|
||||||
if not (currency and journal):
|
if not (currency and journal):
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in new issue
Block a user