Browse Source

pos_payment_terminal: use currency precision

pull/389/head
andreparames 7 years ago
committed by Denis Roussel
parent
commit
69d34e5292
  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): def _match_transactions_to_payments(self, pos_order):
payments = pos_order['statement_ids'] payments = pos_order['statement_ids']
transactions = pos_order['transactions'] 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([ card_journals = self.env['account.journal'].search([
('id', 'in', [p[2]['journal_id'] for p in payments]), ('id', 'in', [p[2]['journal_id'] for p in payments]),
('payment_mode', '!=', False), ('payment_mode', '!=', False),
@ -27,7 +30,7 @@ class PosOrder(models.Model):
if 'amount_cents' in obj: if 'amount_cents' in obj:
return obj['amount_cents'] return obj['amount_cents']
else: else:
return int(round(obj['amount'] * 100))
return int(round(obj['amount'] * pow(10, currency_digits)))
try: try:
for payment, transaction in match(card_payments, transactions, for payment, transaction in match(card_payments, transactions,

Loading…
Cancel
Save