From f84973578ea28842be7d111ae63b016a749a7b5f Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Thu, 29 Aug 2019 09:16:45 +0000 Subject: [PATCH] [FIX] point_of_sale: total discount computation When the total discount is computed on a receipt, it is computed based on the the discount applied on lines, and the difference between the pricelist price and the unit price. But there is an option on the pricelist that say if you want to show or not the difference. Which is not respected in this case because in total we always show all discount. So we are now respecting the policy of the pricelist. TASK-ID: 2058650 --- 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 5f8d437d8aa..445df2f9fd6 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2777,7 +2777,9 @@ exports.Order = Backbone.Model.extend({ get_total_discount: function() { return round_pr(this.orderlines.reduce((function(sum, orderLine) { sum += (orderLine.get_unit_price() * (orderLine.get_discount()/100) * orderLine.get_quantity()); - sum += ((orderLine.get_lst_price() - orderLine.get_unit_price()) * orderLine.get_quantity()); + if (orderLine.display_discount_policy() === 'without_discount'){ + sum += ((orderLine.get_lst_price() - orderLine.get_unit_price()) * orderLine.get_quantity()); + } return sum; }), 0), this.pos.currency.rounding); },