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

Odoo 14.  I have a widget many2many checkboxes, related model crm_tag. The list includes 6 boxes. I also have a toggle button on the same form. 

When this button is set to 1(true) i need an automation to check one of checkboxes. What Python expression could be used to achieve this?


Thanks!

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

Hello Peter,

Please find the below Python code done in Automated Action. 
And add these fields :
- Trigger : On update
- Trigger Fields : select the toggle button field
- Action To do : Execute Python Code
Where ‘x_selection_field’ is the field you want to update based on toggle button field.

Find Example in comment.

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Ảnh đại diện
Huỷ bỏ

sale_order = env['sale.order'].search([('id','=',record['id'])])
if sale_order['x_toggle_boolean']:
sale_order['x_selection_field'] = 'ans1'

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 23
2667
1
thg 5 22
4515
0
thg 11 21
21
0
thg 11 21
3627
0
thg 11 23
1278