i want to select all value of the route_ids in the product.template in default but i'm having hard time figuring out how to select the value of this many2many_checkbox with python code ,is there any way to do so ? I need your help please
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
hello
when you write into the many2many field, at that time you can use like
product_id.write({'route_ids': [(6, 0, list_of_route_record_ids)]})
for write in field many2many type the process is same, just using widget it display data in different format.
so override the default_get method and in the return result of the method you have to update the value.
@api.model
def default_get(self, fieldslist):
res = super(classname, self).default_get(fieldlist)
res.update({'route_ids': [(6, 0, record_ids)]}) # where record_ids = you have to search route ids and pass the list of record
return res
Hi Mitul Shingala,
thank you for your answer, I think it worked,
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 11 17
|
2813 | ||
|
2
thg 10 23
|
6214 | ||
|
2
thg 11 22
|
6634 | ||
|
1
thg 11 21
|
5905 | ||
|
0
thg 9 21
|
2758 |