From 24df6dc8b24712489d5732429de48e62dcbeccca Mon Sep 17 00:00:00 2001 From: Frederic van der Essen Date: Mon, 18 Aug 2014 14:47:53 +0200 Subject: [PATCH] [FIX] product, point_of_sale: add a display_default_code context option that can remove the internal reference (default code) from the displayed product name. Used in the point of sale to unclutter the receipt & GUI --- addons/point_of_sale/static/src/js/models.js | 4 ++-- addons/product/product.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 5718c9afce7..f41f03a4071 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -241,7 +241,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal 'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description', 'product_tmpl_id'], domain: function(self){ return [['sale_ok','=',true],['available_in_pos','=',true]]; }, - context: function(self){ return { pricelist: self.pricelist.id }; }, + context: function(self){ return { pricelist: self.pricelist.id, display_default_code: false }; }, loaded: function(self, products){ self.db.add_products(products); }, @@ -713,7 +713,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal unit_name: this.get_unit().name, price: this.get_unit_price(), discount: this.get_discount(), - product_name: this.get_product().name, + product_name: this.get_product().display_name, price_display : this.get_display_price(), price_with_tax : this.get_price_with_tax(), price_without_tax: this.get_price_without_tax(), diff --git a/addons/product/product.py b/addons/product/product.py index 90a3c3ae6ff..a7284296222 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -979,7 +979,7 @@ class product_product(osv.osv): def _name_get(d): name = d.get('name','') - code = d.get('default_code',False) + code = context.get('display_default_code', True) and d.get('default_code',False) or False if code: name = '[%s] %s' % (code,name) return (d['id'], name)