From 5942bca980d11ef520233c795ab1cb7bc562a3db Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 7 Mar 2019 08:43:53 +0100 Subject: [PATCH] [10.0] FIX amount when currency is not default - take exchange rate into account --- account_bank_statement_import_camt/models/parser.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/account_bank_statement_import_camt/models/parser.py b/account_bank_statement_import_camt/models/parser.py index 2e0afae..da9f377 100644 --- a/account_bank_statement_import_camt/models/parser.py +++ b/account_bank_statement_import_camt/models/parser.py @@ -76,6 +76,14 @@ class CamtParser(models.AbstractModel): transaction, 'ref' ) amount = self.parse_amount(ns, node) + + # Tx conversion devise + xchgrate = node.xpath( + '../../ns:AmtDtls/ns:TxAmt/ns:CcyXchg/ns:XchgRate', namespaces={'ns': ns}) + # If there is a tx, then we do the conversion + if xchgrate: + amount = amount * float(xchgrate[0].text) + if amount != 0.0: transaction['amount'] = amount # remote party values