From 6e945de681452d6753f58a749352bfbe099bac1d Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Wed, 9 Dec 2015 10:33:15 +0100 Subject: [PATCH] [FIX] point_of_sale: don't error when splitting an order 4b003afd0ab125b0296de8939626ae889ccdab47 made it so that the constructor of an orderline calls set_quantity(). The issue is that this function first asserts that the order is editable. pos_restaurant uses the clone() of orderline when splitting an order, and this method did not set order, leading to an error. This fixes the issue by temporarily cloning the order reference, and then setting it back to null. It's not the cleanest fix, but seeing as how the clone() method is only used in one place this will have to do for now. --- addons/point_of_sale/static/src/js/models.js | 3 ++- 1 file changed, 2 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 4f49f070194..71592e9f7d4 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -885,10 +885,11 @@ openerp.point_of_sale.load_models = function load_models(instance, module){ //mo clone: function(){ var orderline = new module.Orderline({},{ pos: this.pos, - order: null, + order: this.order, product: this.product, price: this.price, }); + orderline.order = null; orderline.quantity = this.quantity; orderline.quantityStr = this.quantityStr; orderline.discount = this.discount;