Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5439 Lượt xem

Hello to all , I want to ask how I can create 2 many2one fields which have a relation with two fields of the same class.

   'my_products':fields.many2one('product.product','Parent'), 
   'product':fields.many2one('product.product','Product')

The problem is that both fields bring the same values of the fields of product.product . I want to create relation of many2one with two different fields of product.product. Please guide me

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

By default many2one field will show name field of object(product.product) in search list. You might can overwrite the name_search method for showing the different field of product object. This may help you but not for sure.

Ảnh đại diện
Huỷ bỏ
Tác giả

but the problem is that in one many2one field , I do want to show names and its working ok . For the other many2one field, I want to relate other field. How can this be done ? It will be helpful if you please share some example or refer some link . Thanks

Câu trả lời hay nhất

It's possible. I think the code is ok. Please show the xml.

Update:

Pls. try:

<field name="product"/>
<field name="my_products"/>

Ảnh đại diện
Huỷ bỏ
Tác giả

<field name="product"/>

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 15
3118
1
thg 3 15
4652
1
thg 3 15
4258
1
thg 3 15
8784
2
thg 4 21
17125