From ae1aec32c249114030f5201bb00c1801a95e87d8 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 17 May 2017 15:08:37 +0200 Subject: [PATCH] [FIX] point_of_sale: round taxes as in amount_tax amount_tax compute method uses `price * (1 - (discount or 0.0) / 100.0)` _create_account_move_line method used `price * (100.0 - discount) / 100.0` with price = 9.95 and discount = 0.1 it makes a difference >>> 9.95 * 0.9 8.955 >>> 9.95 * 90.0 / 100.0 8.954999999999998 Cumulative errors makes a 1 cent difference between totals of the orders and computed amounts. The session could not be closed as debit != credit opw-743188 --- addons/point_of_sale/models/pos_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 22dbe74489d..402ae6ea585 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -292,7 +292,8 @@ class PosOrder(models.Model): taxes = line.tax_ids_after_fiscal_position.filtered(lambda t: t.company_id.id == current_company.id) if not taxes: continue - for tax in taxes.compute_all(line.price_unit * (100.0 - line.discount) / 100.0, cur, line.qty)['taxes']: + price = line.price_unit * (1 - (line.discount or 0.0) / 100.0) + for tax in taxes.compute_all(price, cur, line.qty)['taxes']: insert_data('tax', { 'name': _('Tax') + ' ' + tax['name'], 'product_id': line.product_id.id,