This question has been flagged
2 Replies
3104 Views

Hello,

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.


Avatar
Discard
Best Answer

Hi,

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

addons/sale/sale.py:759
@api.multi
@api.onchange('product_id')
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

Avatar
Discard
Author Best Answer

Hello,

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


Avatar
Discard