From a666cd06bd2580d345f4592bf8a64c991f737e79 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 7 Sep 2016 12:07:49 +0200 Subject: [PATCH] [FIX] point_of_sale: round globally Commit 06754b32 brings an inconsistency between the PoS frontend, the pos_order and the account_invoice tax calculation. Part of the commit is correct since it corrects the matching between the `compute_all` methods, however. opw-680891 --- addons/point_of_sale/static/src/js/models.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index ec0eede134a..e53fd2e7d4a 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1386,6 +1386,7 @@ exports.Orderline = Backbone.Model.extend({ }, get_all_prices: function(){ var price_unit = this.get_unit_price() * (1.0 - (this.get_discount() / 100.0)); + var taxtotal = 0; var product = this.get_product(); var taxes_ids = product.taxes_id; @@ -1401,13 +1402,14 @@ exports.Orderline = Backbone.Model.extend({ var all_taxes = this.compute_all(product_taxes, price_unit, this.get_quantity(), this.pos.currency.rounding); _(all_taxes.taxes).each(function(tax) { + taxtotal += tax.amount; taxdetail[tax.id] = tax.amount; }); return { "priceWithTax": all_taxes.total_included, "priceWithoutTax": all_taxes.total_excluded, - "tax": all_taxes.total_included - all_taxes.total_excluded, + "tax": taxtotal, "taxDetails": taxdetail, }; },