From e63681cef75d81c1e52927d9f324eae89bcb6a69 Mon Sep 17 00:00:00 2001 From: Iryna Vyshnevska Date: Mon, 2 Sep 2019 15:02:25 +0300 Subject: [PATCH] [12.0][IMP] use addres when no partner when no partner_name send in bank statement address can be used for partner identification --- .../models/parser.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/account_bank_statement_import_camt_oca/models/parser.py b/account_bank_statement_import_camt_oca/models/parser.py index 1e6fd9d..009e8a8 100644 --- a/account_bank_statement_import_camt_oca/models/parser.py +++ b/account_bank_statement_import_camt_oca/models/parser.py @@ -86,8 +86,16 @@ class CamtParser(models.AbstractModel): party_node = node.xpath( './ns:RltdPties/ns:%s' % party_type, namespaces={'ns': ns}) if party_node: - self.add_value_from_node( - ns, party_node[0], './ns:Nm', transaction, 'partner_name') + name_node = node.xpath( + './ns:RltdPties/ns:%s/ns:Nm' % party_type, + namespaces={'ns': ns}) + if name_node: + self.add_value_from_node( + ns, party_node[0], './ns:Nm', transaction, 'partner_name') + else: + self.add_value_from_node( + ns, party_node[0], './ns:PstlAdr/ns:AdrLine', + transaction, 'partner_name') # Get remote_account from iban or from domestic account: account_node = node.xpath( './ns:RltdPties/ns:%sAcct/ns:Id' % party_type,