[FIX] product, point_of_sale: add a display_default_code context option that can...
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Mon, 18 Aug 2014 12:47:53 +0000 (14:47 +0200)
committerFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Mon, 18 Aug 2014 12:51:15 +0000 (14:51 +0200)
addons/point_of_sale/static/src/js/models.js
addons/product/product.py

index 5718c9a..f41f03a 100644 (file)
@@ -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(),
index 90a3c3a..a728429 100644 (file)
@@ -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)