From 6f950482d3af0605dfd5246ef3a3b7acbacb9c39 Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Thu, 29 Aug 2019 14:42:23 +0000 Subject: [PATCH] [FIX] point_of_sale, pos_restaurant: merging products Before this fix product lines did not merge on adding a same product after transfering an order or re-opening an order that was synced. To verefy if lines can be merged an unused field 'type' was compared. Removing this field fixes the problem. --- addons/point_of_sale/static/src/js/models.js | 7 ------- addons/point_of_sale/static/src/js/screens.js | 1 - .../static/src/js/tours/pos_restaurant.js | 11 ++++++++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index bb34b3dca30..d413b9428b8 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1410,7 +1410,6 @@ exports.Orderline = Backbone.Model.extend({ this.set_quantity(1); this.discount = 0; this.discountStr = '0'; - this.type = 'unit'; this.selected = false; this.id = orderline_id++; this.price_manually_set = false; @@ -1448,7 +1447,6 @@ exports.Orderline = Backbone.Model.extend({ orderline.quantityStr = this.quantityStr; orderline.discount = this.discount; orderline.price = this.price; - orderline.type = this.type; orderline.selected = false; orderline.price_manually_set = this.price_manually_set; return orderline; @@ -1471,9 +1469,6 @@ exports.Orderline = Backbone.Model.extend({ get_discount_str: function(){ return this.discountStr; }, - get_product_type: function(){ - return this.type; - }, // sets the quantity of the product. The quantity will be rounded according to the // product's unity of measure properties. Quantities greater than zero will not get // rounded to zero @@ -1593,8 +1588,6 @@ exports.Orderline = Backbone.Model.extend({ return false; }else if(!this.get_unit() || !this.get_unit().is_pos_groupable){ return false; - }else if(this.get_product_type() !== orderline.get_product_type()){ - return false; }else if(this.get_discount() > 0){ // we don't merge discounted orderlines return false; }else if(!utils.float_is_zero(price - orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity()), diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index d8424baca6d..98404264ea8 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -688,7 +688,6 @@ var ProductCategoriesWidget = PosBaseWidget.extend({ init: function(parent, options){ var self = this; this._super(parent,options); - this.product_type = options.product_type || 'all'; // 'all' | 'weightable' this.onlyWeightable = options.onlyWeightable || false; this.category = this.pos.root_category; this.breadcrumb = []; diff --git a/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js b/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js index d492be57050..37e3cc1adc2 100644 --- a/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js +++ b/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js @@ -184,8 +184,17 @@ odoo.define('pos_reataurant.tour.synchronized_table_management', function (requi // Test transfering an order steps = steps.concat(transfer_order_to_table('T4', '002-0001')); + // Test if products still get merged after transfering the order + steps = steps.concat(add_product_to_order('Coca-Cola')); + steps = steps.concat({ + content: 'check the order-line for Coca-Cola has 2 Units', + trigger: '.orderlines:has(.orderline .product-name:contains("Coca-Cola")) .info-list:contains("2.000")', + run: function () {}, + }) + steps = steps.concat(generate_product_screen_keypad_steps('1')); + steps = steps.concat(goto_payment_screen_and_select_payment_method()); - steps = steps.concat(generate_payment_screen_keypad_steps('4.40')); + steps = steps.concat(generate_payment_screen_keypad_steps('4.4')); steps = steps.concat(finish_order()); steps = steps.concat(open_table('T2'));