Odoo Help


Need to figure out how to have Product Field --> Internal Code and Description --> Product Name

on 10/1/16, 10:13 PM 611 views


I have been trying to figure out in Odoo9 instead of having [4423]Apple iWatch White in both the Product and Description columns would like to have 4423 in the Product column and Apple iWatch White in the Description column.

I have look on the odoo forums and found threads that talk about how to remove the sku, but when i do that it removes it for both columns. This is not the results I need.

I have already treid to edit name_gate to:

def name_get(self, cr, user, ids, context=None):

  res = []
 if context is None:
  context = {}
 if isinstance(ids, (int, long)):
  ids = [ids]
 if not len(ids):
  return []
 for product in self.browse(cr, user, ids,context=context):
  res.append((product.id, product.name))
 return res

But this removes the internal code.

I appericate any help!

Thank you.


Bejaoui Souheil

--Bejaoui Souheil--
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant


Bejaoui Souheil
On 10/2/16, 5:53 AM


If we take the sale order as example, you can see how the field description is set.

def product_id_change(self):
    name = product.name_get()[0][1]
    if product.description_sale:
name += '\n' + product.description_sale
    vals['name'] = name

Overbidding  the get_name will give you always the same result in the two columns.

So, you have to override the onchange function to set whatever you want or simply define a value for  description_sale on your product

On 10/2/16, 1:35 PM


Thank you for your reply.

In purchase.py

self.name = product_lang.display_name
if product_lang.description_purchase: self.name += '\n' + product_lang.description_purchase

So I would have to change self.name to equal product name. What is the product name variable?

EDIT: I created a new function and it works perfectly.

In sale.sy

name = product.name_get()[0][1]        
if product.description_sale: name += '\n' + product.description_sale

What are the [0][1] for? Also would I have to make another name_get() function in product.py?.
EDIT: I created a new function and it works perfectly.

Thank you


Bejaoui Souheil
on 10/3/16, 3:48 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/1/16, 10:13 PM
Seen: 611 times
Last updated: 10/2/16, 4:18 PM