[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

This commit is contained in:
Frederic van der Essen 2014-08-18 14:47:53 +02:00
parent 01e647b57d
commit 24df6dc8b2
2 changed files with 3 additions and 3 deletions

View 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', 'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description',
'product_tmpl_id'], 'product_tmpl_id'],
domain: function(self){ return [['sale_ok','=',true],['available_in_pos','=',true]]; }, 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){ loaded: function(self, products){
self.db.add_products(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, unit_name: this.get_unit().name,
price: this.get_unit_price(), price: this.get_unit_price(),
discount: this.get_discount(), discount: this.get_discount(),
product_name: this.get_product().name, product_name: this.get_product().display_name,
price_display : this.get_display_price(), price_display : this.get_display_price(),
price_with_tax : this.get_price_with_tax(), price_with_tax : this.get_price_with_tax(),
price_without_tax: this.get_price_without_tax(), price_without_tax: this.get_price_without_tax(),

View File

@ -979,7 +979,7 @@ class product_product(osv.osv):
def _name_get(d): def _name_get(d):
name = d.get('name','') 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: if code:
name = '[%s] %s' % (code,name) name = '[%s] %s' % (code,name)
return (d['id'], name) return (d['id'], name)