Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
3656 Представления

Hi,

I'm stuck because i want change product_id view in sale and purchase module. I try describe what i mean:

Product id view as:  [default_code] + name but i want change to view if product has default_old_code view [default_old_code] + name else view as previously mentioned. I can;t resolve how can i do it because. I was looking for in purchase but i didn't find it. Someone can help me because it's really important for me and maybe it's really simple but i cant figure out how change it. I can't understand how odoo take 2 fields default_code and name and join together but this field is a id number of product.

I hope someone helps me.    

Аватар
Отменить
Лучший ответ

Hello,

you have to override the "name_get" and replace the fields you need to have the unique "code".

Аватар
Отменить
Автор Лучший ответ

@GiusyG Any sample code? Where can i find "name_get"? More details please. I'm not specialist in odoo :)

Аватар
Отменить

@api.multi

def name_get(self):

# Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields

self.read(['name', 'default_code'])

return [(template.id, '%s%s' % (template.default_code and '[%s] ' % template.default_code or '', template.name))

for template in self]

Автор

Should i this method override as model product.product?

it shows you the name of the product in sale.order.line in the desired format.

Please rate my answer if I have been of help to you ..

Автор

But should i do this in which model? If you help me i rate your answear.

_inherit = 'product.product'

Related Posts Ответы Просмотры Активность
1
авг. 24
5793
0
мар. 15
3443
1
июн. 23
3127
1
июл. 16
8018
2
сент. 21
3970