Browse Source

camt: remove dead code

Fix warning account.bank.statement.line.create() includes unknown fields: data, execution_date, transfer_type, value_date
pull/147/head
Alexis de Lattre 7 years ago
parent
commit
209ac9195b
  1. 25
      account_bank_statement_import_camt/models/parser.py

25
account_bank_statement_import_camt/models/parser.py

@ -83,14 +83,6 @@ class CamtParser(models.AbstractModel):
if party_node: if party_node:
self.add_value_from_node( self.add_value_from_node(
ns, party_node[0], './ns:Nm', transaction, 'partner_name') 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: # Get remote_account from iban or from domestic account:
account_node = node.xpath( account_node = node.xpath(
'./ns:RltdPties/ns:%sAcct/ns:Id' % party_type, './ns:RltdPties/ns:%sAcct/ns:Id' % party_type,
@ -101,32 +93,17 @@ class CamtParser(models.AbstractModel):
'./ns:IBAN', namespaces={'ns': ns}) './ns:IBAN', namespaces={'ns': ns})
if iban_node: if iban_node:
transaction['account_number'] = iban_node[0].text 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: else:
self.add_value_from_node( self.add_value_from_node(
ns, account_node[0], './ns:Othr/ns:Id', transaction, ns, account_node[0], './ns:Othr/ns:Id', transaction,
'account_number' 'account_number'
) )
transaction['data'] = etree.tostring(node)
def parse_entry(self, ns, node): def parse_entry(self, ns, node):
"""Parse an Ntry node and yield transactions""" """Parse an Ntry node and yield transactions"""
transaction = {'name': '/', 'amount': 0} # fallback defaults 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( self.add_value_from_node(
ns, node, './ns:BookgDt/ns:Dt', transaction, 'date') 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) amount = self.parse_amount(ns, node)
if amount != 0.0: if amount != 0.0:
transaction['amount'] = amount transaction['amount'] = amount
@ -196,8 +173,6 @@ class CamtParser(models.AbstractModel):
) )
self.add_value_from_node( self.add_value_from_node(
ns, node, './ns:Id', result, 'name') ns, node, './ns:Id', result, 'name')
self.add_value_from_node(
ns, node, './ns:Dt', result, 'date')
self.add_value_from_node( self.add_value_from_node(
ns, node, './ns:Acct/ns:Ccy', result, 'currency') ns, node, './ns:Acct/ns:Ccy', result, 'currency')
result['balance_start'], result['balance_end_real'] = ( result['balance_start'], result['balance_end_real'] = (

Loading…
Cancel
Save