[FIX] point_of_sale: fix included price

Complement of 5b50284127

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
This commit is contained in:
Nicolas Martinelli
2017-10-24 17:06:39 +02:00
parent bc84eb2035
commit cc37b34f43
2 changed files with 8 additions and 1 deletions
@@ -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');
},
@@ -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 {
};
});