Hi,
I need to set one of my one2many field as static,That is, I have a one2many field and one of its field values should be set before its loading.
How can I do that??
Please help
Thanks in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
I need to set one of my one2many field as static,That is, I have a one2many field and one of its field values should be set before its loading.
How can I do that??
Please help
Thanks in advance
Hello
you can see the example in "working time".
Activate the debug mode, Go to Settings -> Technical -> Resource -> working time. click on Create button, after that you will get the Working hours by default.
=> using default_get of your main object you can achieve this.
@api.model
def default_get(self, fields_list):
res = super(classname, self).default_get(fields_list)
vals = [(0, 0, {'field_1': value_1, 'field_2': value_2}),
(0, 0, {'field_1': value_1, 'field_2': value_2})]
res.update({'your_o2m_field': vals})
return res
I hope this will helps you.
It worked for me, thanks !
Thank You @ Mitul Shingala
Appreciate for your answer
+1 from me
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 | |
---|---|---|---|---|
|
3
thg 7 19
|
5470 | ||
|
4
thg 11 20
|
7955 | ||
|
1
thg 8 20
|
3988 | ||
|
0
thg 11 18
|
2525 | ||
|
2
thg 3 25
|
8787 |