diff --git a/addons/point_of_sale/static/src/js/db.js b/addons/point_of_sale/static/src/js/db.js index ca0afd28a83..a56e660e768 100644 --- a/addons/point_of_sale/static/src/js/db.js +++ b/addons/point_of_sale/static/src/js/db.js @@ -363,7 +363,9 @@ var PosDB = core.Class.extend({ var list = []; if (product_ids) { for (var i = 0, len = Math.min(product_ids.length, this.limit); i < len; i++) { - list.push(this.product_by_id[product_ids[i]]); + const product = this.product_by_id[product_ids[i]]; + if (!(product.active && product.available_in_pos)) continue; + list.push(product); } } return list; @@ -385,7 +387,9 @@ var PosDB = core.Class.extend({ var r = re.exec(this.category_search_string[category_id]); if(r){ var id = Number(r[1]); - results.push(this.get_product_by_id(id)); + const product = this.get_product_by_id(id); + if (!(product.active && product.available_in_pos)) continue; + results.push(product); }else{ break; } diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 9a6da2ffa79..3c179d2c95b 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -137,8 +137,8 @@ exports.PosModel = Backbone.Model.extend({ searchTerm: '', }; }, - after_load_server_data: function(){ - this.load_orders(); + after_load_server_data: async function(){ + await this.load_orders(); this.set_start_order(); if(this.config.use_proxy){ if (this.config.iface_customer_facing_display) { @@ -476,7 +476,7 @@ exports.PosModel = Backbone.Model.extend({ condition: function (self) { return !self.config.limited_products_loading; }, fields: ['display_name', 'lst_price', 'standard_price', 'categ_id', 'pos_categ_id', 'taxes_id', 'barcode', 'default_code', 'to_weight', 'uom_id', 'description_sale', 'description', - 'product_tmpl_id','tracking', 'write_date', 'available_in_pos', 'attribute_line_ids'], + 'product_tmpl_id','tracking', 'write_date', 'available_in_pos', 'attribute_line_ids', 'active'], order: _.map(['sequence','default_code','name'], function (name) { return {name: name}; }), domain: function(self){ var domain = ['&', '&', ['sale_ok','=',true],['available_in_pos','=',true],'|',['company_id','=',self.config.company_id[0]],['company_id','=',false]]; @@ -833,8 +833,9 @@ exports.PosModel = Backbone.Model.extend({ * Second load all orders belonging to the same config but from other sessions, * Only if tho order has orderlines. */ - load_orders: function(){ + load_orders: async function(){ var jsons = this.db.get_unpaid_orders(); + await this._loadMissingProducts(jsons); var orders = []; for (var i = 0; i < jsons.length; i++) {