mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
@@ -61,7 +61,6 @@ class CamtParser(models.AbstractModel):
|
|||||||
node,
|
node,
|
||||||
[
|
[
|
||||||
"./ns:RmtInf/ns:Ustrd|./ns:RtrInf/ns:AddtlInf",
|
"./ns:RmtInf/ns:Ustrd|./ns:RtrInf/ns:AddtlInf",
|
||||||
"./ns:AddtlNtryInf",
|
|
||||||
"./ns:Refs/ns:InstrId",
|
"./ns:Refs/ns:InstrId",
|
||||||
],
|
],
|
||||||
transaction,
|
transaction,
|
||||||
@@ -329,6 +328,7 @@ class CamtParser(models.AbstractModel):
|
|||||||
|
|
||||||
details_nodes = node.xpath("./ns:NtryDtls/ns:TxDtls", namespaces={"ns": ns})
|
details_nodes = node.xpath("./ns:NtryDtls/ns:TxDtls", namespaces={"ns": ns})
|
||||||
if len(details_nodes) == 0:
|
if len(details_nodes) == 0:
|
||||||
|
self.amend_transaction(transaction)
|
||||||
self.generate_narration(transaction)
|
self.generate_narration(transaction)
|
||||||
yield transaction
|
yield transaction
|
||||||
return
|
return
|
||||||
@@ -336,6 +336,7 @@ class CamtParser(models.AbstractModel):
|
|||||||
for node in details_nodes:
|
for node in details_nodes:
|
||||||
transaction = transaction_base.copy()
|
transaction = transaction_base.copy()
|
||||||
self.parse_transaction_details(ns, node, transaction)
|
self.parse_transaction_details(ns, node, transaction)
|
||||||
|
self.amend_transaction(transaction)
|
||||||
self.generate_narration(transaction)
|
self.generate_narration(transaction)
|
||||||
yield transaction
|
yield transaction
|
||||||
|
|
||||||
@@ -456,3 +457,9 @@ class CamtParser(models.AbstractModel):
|
|||||||
account_number = statement.pop("account_number")
|
account_number = statement.pop("account_number")
|
||||||
statements.append(statement)
|
statements.append(statement)
|
||||||
return currency, account_number, statements
|
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"), "/"
|
||||||
|
)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
'Account Servicer Reference (Refs/AcctSvcrRef): 123456CHCAFEBABE\n'
|
'Account Servicer Reference (Refs/AcctSvcrRef): 123456CHCAFEBABE\n'
|
||||||
'Postal Address (PstlAdr): Place Saint-François | 14 | 1003 | Lausanne | CH1',
|
'Postal Address (PstlAdr): Place Saint-François | 14 | 1003 | Lausanne | CH1',
|
||||||
'partner_name': 'Banque Cantonale Vaudoise',
|
'partner_name': 'Banque Cantonale Vaudoise',
|
||||||
'payment_ref': '/',
|
'payment_ref': 'CRÉDIT GROUPÉ BVR TRAITEMENT DU 22.03.2017 NUMÉRO CLIENT 01-70884-3 PAQUET ID: 123456CHCAFEBABE',
|
||||||
'ref': '302388292000011111111111111',
|
'ref': '302388292000011111111111111',
|
||||||
'transaction_type': 'PMNT-RCDT-VCOM'},
|
'transaction_type': 'PMNT-RCDT-VCOM'},
|
||||||
{'account_number': 'CH3333000000123456789',
|
{'account_number': 'CH3333000000123456789',
|
||||||
@@ -39,6 +39,6 @@
|
|||||||
'Account Servicer Reference (Refs/AcctSvcrRef): 123456CHCAFEBABE\n'
|
'Account Servicer Reference (Refs/AcctSvcrRef): 123456CHCAFEBABE\n'
|
||||||
'Postal Address (PstlAdr): Place Saint-François | 14 | 1003 | Lausanne | CH2',
|
'Postal Address (PstlAdr): Place Saint-François | 14 | 1003 | Lausanne | CH2',
|
||||||
'partner_name': 'Banque Cantonale Vaudoise',
|
'partner_name': 'Banque Cantonale Vaudoise',
|
||||||
'payment_ref': '/',
|
'payment_ref': 'CRÉDIT GROUPÉ BVR TRAITEMENT DU 22.03.2017 NUMÉRO CLIENT 01-70884-3 PAQUET ID: 123456CHCAFEBABE',
|
||||||
'ref': '302388292000022222222222222',
|
'ref': '302388292000022222222222222',
|
||||||
'transaction_type': 'PMNT-RCDT-VCOM'}]}])
|
'transaction_type': 'PMNT-RCDT-VCOM'}]}])
|
||||||
|
|||||||
Reference in New Issue
Block a user