[8.0][FIX] account_bank_statement_import_camt: payment amounts (#169)

This commit is contained in:
Tom
2018-08-08 08:13:28 +02:00
committed by Pedro M. Baeza
parent 24f6549f92
commit 436bf35252
4 changed files with 74 additions and 2 deletions

View File

@@ -44,9 +44,15 @@ class CamtParser(models.AbstractModel):
sign = 1
amount = 0.0
sign_node = node.xpath('ns:CdtDbtInd', namespaces={'ns': ns})
if not sign_node:
sign_node = node.xpath(
'../../ns:CdtDbtInd', namespaces={'ns': ns})
if sign_node and sign_node[0].text == 'DBIT':
sign = -1
amount_node = node.xpath('ns:Amt', namespaces={'ns': ns})
if not amount_node:
amount_node = node.xpath(
'./ns:AmtDtls/ns:TxAmt/ns:Amt', namespaces={'ns': ns})
if amount_node:
amount = sign * float(amount_node[0].text)
return amount