From e18924848ab89cac875b1e8cebaaee31eda09d64 Mon Sep 17 00:00:00 2001 From: Stephane Date: Tue, 16 Jul 2019 10:12:33 +0200 Subject: [PATCH] No update name during parsing If the field "name" of the module "account.bank.statement.line" is already assigned during the parse of the element NtryDtls of the camt053 file, we don't update it to avoid to lose data. --- .../models/parser.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/account_bank_statement_import_camt_oca/models/parser.py b/account_bank_statement_import_camt_oca/models/parser.py index 8bb871c2..83d7bb5c 100644 --- a/account_bank_statement_import_camt_oca/models/parser.py +++ b/account_bank_statement_import_camt_oca/models/parser.py @@ -54,12 +54,13 @@ class CamtParser(models.AbstractModel): def parse_transaction_details(self, ns, node, transaction): """Parse TxDtls node.""" # message - self.add_value_from_node( - ns, node, [ - './ns:RmtInf/ns:Ustrd|./ns:RtrInf/ns:AddtlInf', - './ns:AddtlNtryInf', - './ns:Refs/ns:InstrId', - ], transaction, 'name', join_str='\n') + if transaction['name'] == '/': + self.add_value_from_node( + ns, node, [ + './ns:RmtInf/ns:Ustrd|./ns:RtrInf/ns:AddtlInf', + './ns:AddtlNtryInf', + './ns:Refs/ns:InstrId', + ], transaction, 'name', join_str='\n') # name self.add_value_from_node( ns, node, [