Browse Source

pos_payment_terminal: use currency precision

pull/440/head
andreparames 6 years ago
committed by Sylvain LE GAL
parent
commit
efe4f34100
  1. 5
      pos_payment_terminal/models/pos_order.py

5
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,

Loading…
Cancel
Save