mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[FIX] account_statement_import_camt: Add more info on payment reference instead of / when more info available
Updated changes as suggested pre-commit fixes Fixed call of function
This commit is contained in:
@@ -61,7 +61,6 @@ class CamtParser(models.AbstractModel):
|
||||
node,
|
||||
[
|
||||
"./ns:RmtInf/ns:Ustrd|./ns:RtrInf/ns:AddtlInf",
|
||||
"./ns:AddtlNtryInf",
|
||||
"./ns:Refs/ns:InstrId",
|
||||
],
|
||||
transaction,
|
||||
@@ -329,6 +328,7 @@ class CamtParser(models.AbstractModel):
|
||||
|
||||
details_nodes = node.xpath("./ns:NtryDtls/ns:TxDtls", namespaces={"ns": ns})
|
||||
if len(details_nodes) == 0:
|
||||
self.amend_transaction(transaction)
|
||||
self.generate_narration(transaction)
|
||||
yield transaction
|
||||
return
|
||||
@@ -336,6 +336,7 @@ class CamtParser(models.AbstractModel):
|
||||
for node in details_nodes:
|
||||
transaction = transaction_base.copy()
|
||||
self.parse_transaction_details(ns, node, transaction)
|
||||
self.amend_transaction(transaction)
|
||||
self.generate_narration(transaction)
|
||||
yield transaction
|
||||
|
||||
@@ -456,3 +457,9 @@ class CamtParser(models.AbstractModel):
|
||||
account_number = statement.pop("account_number")
|
||||
statements.append(statement)
|
||||
return currency, account_number, statements
|
||||
|
||||
def amend_transaction(self, transaction):
|
||||
if transaction.get("payment_ref") == "/":
|
||||
transaction["payment_ref"] = transaction["narration"].get(
|
||||
"%s (AddtlNtryInf)" % _("Additional Entry Information"), "/"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user