From 1f62977d5dcfbd172459f13d8e43bbf43c7bcbda Mon Sep 17 00:00:00 2001 From: mgh-odoo Date: Wed, 29 May 2019 05:30:22 +0000 Subject: [PATCH] [FIX] point_of_sale: wrong price on receipt fix Before this commit, if a user select option 'tax-Included Price' in pricing from pos.config and sale product with a discount, it is first displaying price without tax instead of the price including tax. Task-2002464 Closes #33733 closes odoo/odoo#34259 Signed-off-by: Nicolas Martinelli (nim) --- addons/point_of_sale/static/src/js/models.js | 6 ++++++ addons/point_of_sale/static/src/xml/pos.xml | 7 ++++++- 2 files changed, 12 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 1fe17d449a5..054776e658c 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1573,6 +1573,7 @@ exports.Orderline = Backbone.Model.extend({ price_display : this.get_display_price(), price_with_tax : this.get_price_with_tax(), price_without_tax: this.get_price_without_tax(), + price_with_tax_before_discount: this.get_price_with_tax_before_discount(), tax: this.get_tax(), product_description: this.get_product().description, product_description_sale: this.get_product().description_sale, @@ -1669,6 +1670,9 @@ exports.Orderline = Backbone.Model.extend({ get_price_with_tax: function(){ return this.get_all_prices().priceWithTax; }, + get_price_with_tax_before_discount: function () { + return this.get_all_prices().priceWithTaxBeforeDiscount; + }, get_tax: function(){ return this.get_all_prices().tax; }, @@ -1822,6 +1826,7 @@ exports.Orderline = Backbone.Model.extend({ }); var all_taxes = this.compute_all(product_taxes, price_unit, this.get_quantity(), this.pos.currency.rounding); + var all_taxes_before_discount = this.compute_all(product_taxes, this.get_unit_price(), this.get_quantity(), this.pos.currency.rounding); _(all_taxes.taxes).each(function(tax) { taxtotal += tax.amount; taxdetail[tax.id] = tax.amount; @@ -1831,6 +1836,7 @@ exports.Orderline = Backbone.Model.extend({ "priceWithTax": all_taxes.total_included, "priceWithoutTax": all_taxes.total_excluded, "priceSumTaxVoid": all_taxes.total_void, + "priceWithTaxBeforeDiscount": all_taxes_before_discount.total_included, "tax": taxtotal, "taxDetails": taxdetail, }; diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 17c47b154ad..0ac71c21530 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -812,7 +812,12 @@ - + + + + + +