From cc37b34f4367c8b101ba24dba9bb91a988ea0443 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 24 Oct 2017 14:11:31 +0200 Subject: [PATCH] [FIX] point_of_sale: fix included price Complement of 5b502841276dda0dbc0161fd0fa080d1790086bb The mentioned commit works well when adding a product, but - changing the quantity - changing the customer won't trigger the fix of the included price. opw-776530 --- addons/point_of_sale/static/src/js/models.js | 2 ++ addons/point_of_sale/static/src/js/screens.js | 7 ++++++- 2 files changed, 8 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 5e337fa4cc1..e0d3e5e60fb 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1393,6 +1393,7 @@ exports.Orderline = Backbone.Model.extend({ // just like in sale.order changing the quantity will recompute the unit price if(! keep_price){ this.set_unit_price(this.product.get_price(this.order.pricelist, this.get_quantity())); + this.order.fix_tax_included_price(this); } }, // return the quantity of product @@ -2294,6 +2295,7 @@ exports.Order = Backbone.Model.extend({ this.pricelist = pricelist; _.each(this.get_orderlines(), function (line) { line.set_unit_price(line.product.get_price(self.pricelist, line.get_quantity())); + self.fix_tax_included_price(line); }); this.trigger('change'); }, diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 5aef8f92d26..04bb1b2d44b 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -2080,6 +2080,12 @@ var set_fiscal_position_button = ActionButtonWidget.extend({ confirm: function (fiscal_position) { var order = self.pos.get_order(); order.fiscal_position = fiscal_position; + // This will trigger the recomputation of taxes on order lines. + // It is necessary to manually do it for the sake of consistency + // with what happens when changing a customer. + _.each(order.orderlines.models, function (line) { + line.set_quantity(line.quantity); + }); order.trigger('change'); }, is_selected: function (fiscal_position) { @@ -2188,4 +2194,3 @@ return { }; }); -