Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
4236 Tampilan

Hello,


Can someone tell me how to do this?


Thank you so much for your help!

Avatar
Buang
Penulis

Thank you Ray!

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

Jawaban Terbai
server_action = env['ir.actions.server'].search([('name','=','Second Server Action')])
if server_action:
server_action.run()
Avatar
Buang
Jawaban Terbai

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()




Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Mar 23
2078
0
Jul 21
4806
1
Jan 21
5498
1
Jan 19
5324
1
Jan 18
4932