[11.0][FIX] account_bank_statement_import_camt: payment amounts (#168)

This commit is contained in:
Andrea Stirpe
2018-08-08 08:14:07 +02:00
committed by Thomas Binsfeld
parent daf664cf1a
commit 0b1a9b4561
5 changed files with 82 additions and 3 deletions

View File

@@ -19,9 +19,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