From 209ac9195b9dfe499d8315eaeb1ac5477579255e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 20 Feb 2018 10:05:40 +0100 Subject: [PATCH] camt: remove dead code Fix warning account.bank.statement.line.create() includes unknown fields: data, execution_date, transfer_type, value_date --- .../models/parser.py | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/account_bank_statement_import_camt/models/parser.py b/account_bank_statement_import_camt/models/parser.py index c6b75e3..c98e715 100644 --- a/account_bank_statement_import_camt/models/parser.py +++ b/account_bank_statement_import_camt/models/parser.py @@ -83,14 +83,6 @@ class CamtParser(models.AbstractModel): if party_node: self.add_value_from_node( ns, party_node[0], './ns:Nm', transaction, 'partner_name') - self.add_value_from_node( - ns, party_node[0], './ns:PstlAdr/ns:Ctry', transaction, - 'partner_country' - ) - address_node = party_node[0].xpath( - './ns:PstlAdr/ns:AdrLine', namespaces={'ns': ns}) - if address_node: - transaction['partner_address'] = [address_node[0].text] # Get remote_account from iban or from domestic account: account_node = node.xpath( './ns:RltdPties/ns:%sAcct/ns:Id' % party_type, @@ -101,32 +93,17 @@ class CamtParser(models.AbstractModel): './ns:IBAN', namespaces={'ns': ns}) if iban_node: transaction['account_number'] = iban_node[0].text - bic_node = node.xpath( - './ns:RltdAgts/ns:%sAgt/ns:FinInstnId/ns:BIC' % party_type, - namespaces={'ns': ns} - ) - if bic_node: - transaction['account_bic'] = bic_node[0].text else: self.add_value_from_node( ns, account_node[0], './ns:Othr/ns:Id', transaction, 'account_number' ) - transaction['data'] = etree.tostring(node) def parse_entry(self, ns, node): """Parse an Ntry node and yield transactions""" transaction = {'name': '/', 'amount': 0} # fallback defaults - self.add_value_from_node( - ns, node, './ns:BkTxCd/ns:Prtry/ns:Cd', transaction, - 'transfer_type' - ) self.add_value_from_node( ns, node, './ns:BookgDt/ns:Dt', transaction, 'date') - self.add_value_from_node( - ns, node, './ns:BookgDt/ns:Dt', transaction, 'execution_date') - self.add_value_from_node( - ns, node, './ns:ValDt/ns:Dt', transaction, 'value_date') amount = self.parse_amount(ns, node) if amount != 0.0: transaction['amount'] = amount @@ -196,8 +173,6 @@ class CamtParser(models.AbstractModel): ) self.add_value_from_node( ns, node, './ns:Id', result, 'name') - self.add_value_from_node( - ns, node, './ns:Dt', result, 'date') self.add_value_from_node( ns, node, './ns:Acct/ns:Ccy', result, 'currency') result['balance_start'], result['balance_end_real'] = (