How do I show the product default code in the "Product" column and product name in the "Description" column?
Thank you
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How do I show the product default code in the "Product" column and product name in the "Description" column?
Thank you
In which part of the product.py I need to put your piece of code to be functional?
I try to modify the product_id and name field too to show different elements but I can't do it..
To show only the name without the code in Description field, you can do: (product.py line 1017 +/-)
def _name_get(d):
name = d.get('name','')
code = context.get('display_default_code', True) and d.get('default_code',False) or False
return (d['id'],name)
But because of I can't try your code I don't know if this will overwrite your class or not. It means that I understand that your "Product" column is searchable too. With the change that I tell, this column is searchable and it only shows the product name.
I'll try yo add another field to product changing the python code, but I can't do it too. This change will be to add an extra field that only have the default code apart of the fields 'product_id' and 'name'.
Hi everyone, I found how to show in th product column the default_code but for the description I still get the default_code + the name any help about this
This is my code:
class snc_product(osv.osv):
_name='product.product'
_inherit='product.product'
def name_get(self, cr, uid, ids, context=None):
return_val = super(snc_product, self).name_get(cr, uid, ids, context=context)
res = []
def _name_get(d):
code = d.get('code','')
if d.get('variants'):
code = code + ' - %s' % (d['variants'],)
return (d['id'], code)
for product in self.browse(cr, uid, ids, context=context):
res.append((product.id, (product.code)))
return res or return_val