I have a many2many checkboxes widget.
I want all checkboxes to be checked by default.
How can i do this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have a many2many checkboxes widget.
I want all checkboxes to be checked by default.
How can i do this?
Hi, Josef,
you should define the many2Many field with the default option.
service_ids = fields.Many2many('sale.order.service.type.line', 'service_type_line_tag_rel', 'order_id', 'order_service_type_id', string = 'service_ids', tracking = True, default = lambda self: self.env['sale.order.service.type.line'].search([('id', '=', 2)]))
Attention to the default option in the above example and modify it to your own requirement.
Thanks.
----------
Update:
Josef, for details you can refer to:
https://www.odoo.com/zh_CN/forum/bang-zhu-1/how-create-a-check-box-field-in-custom-module-94390
Thanks.
Hey, I tried this
event_booth_ids = fields.Many2many('event.booth', string='Stände', default=lambda self: self.env['event.booth'].search([('id', '=', 2)]))
but it does not work
what am i doing wrong?
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 | |
---|---|---|---|---|
|
0
thg 6 22
|
2420 | ||
|
2
thg 12 23
|
2195 | ||
|
1
thg 12 23
|
2660 | ||
|
1
thg 2 24
|
2228 | ||
|
2
thg 8 23
|
2333 |