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:
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'] = (

Loading…
Cancel
Save