Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3794 มุมมอง

Hello,


Can someone tell me how to do this?


Thank you so much for your help!

อวตาร
ละทิ้ง
ผู้เขียน

Thank you Ray!

In case I have to give a parameter, do I put it between the parenthesis of ".run()"?

คำตอบที่ดีที่สุด
server_action = env['ir.actions.server'].search([('name','=','Second Server Action')])
if server_action:
server_action.run()
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Thanks for solution Ray, massive help.
To add further use case to this solution, we can specify context to run on specific records (using for loop for example) like this: (I prefer to use action id instead of name, since name can be changed easily)

server_action = env['ir.actions.server'].search([('id','=', your_server_action_id)])
if server_action:
​for record in records:
​server_action.with_context(active_id = record.id, active_model = 'your_model_name').run()




อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 23
1774
0
ก.ค. 21
4430
1
ม.ค. 21
5118
1
ม.ค. 19
5050
1
ม.ค. 18
4607