From a46caa710967d4708907cdba093e01f903e6cb29 Mon Sep 17 00:00:00 2001 From: andreparames Date: Thu, 3 May 2018 15:21:08 +0200 Subject: [PATCH] pos_payment_terminal: use currency precision --- pos_payment_terminal/models/pos_order.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pos_payment_terminal/models/pos_order.py b/pos_payment_terminal/models/pos_order.py index 723a992b..a0d0b66b 100644 --- a/pos_payment_terminal/models/pos_order.py +++ b/pos_payment_terminal/models/pos_order.py @@ -16,6 +16,9 @@ class PosOrder(models.Model): def _match_transactions_to_payments(self, pos_order): payments = pos_order['statement_ids'] transactions = pos_order['transactions'] + pos_session = self.env['pos.session'].browse( + pos_order['pos_session_id']) + currency_digits = pos_session.currency_id.decimal_places card_journals = self.env['account.journal'].search([ ('id', 'in', [p[2]['journal_id'] for p in payments]), ('payment_mode', '!=', False), @@ -27,7 +30,7 @@ class PosOrder(models.Model): if 'amount_cents' in obj: return obj['amount_cents'] else: - return int(round(obj['amount'] * 100)) + return int(round(obj['amount'] * pow(10, currency_digits))) try: for payment, transaction in match(card_payments, transactions,