[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.
This commit is contained in:
Gert Pellin
2019-09-13 10:05:44 +00:00
committed by Pierre Masereel
parent bc863ef4a5
commit 6f950482d3
3 changed files with 10 additions and 9 deletions
@@ -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()),
@@ -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 = [];
@@ -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'));