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

Hello,

how to return two different ir.actions.act_window' actions ????

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

First install this OCA App.

https://apps.odoo.com/apps/modules/11.0/web_ir_actions_act_multi/

Consider the following example.

action_window = {
'type': 'ir.actions.act_window',
'res_model': 'crm.lead',
'res_id': self.id,
'views': [(form_view.id, 'form'), ],
'target': 'inline',
}
action_close = {'type': 'ir.actions.act_window_close'}

return {
'type': 'ir.actions.act_multi',
'actions': [action_window, action_close]
}

Regards

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You cannot. The return by defition is only 1.

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

so can i execute the first action and secondly execute the second action ?

Manually, sure. But why not just combine those two actions into one?

Kaisusr, you cannot return 2 actions. But if you want to run the action sequentially, then you can add a button in the view that is called by the first action to call the 2nd action.

คำตอบที่ดีที่สุด

You could still do some work after return if you return from a try-block, the finally-block would still be executed, e.g.:

try:            
​return FIRST_ACTION
finally:
​return SECOND_ACTION
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 23
1189
1
มี.ค. 15
5927
1
มี.ค. 24
2691
4
มี.ค. 22
4701
Hide an "act_window id" แก้ไขแล้ว
3
ต.ค. 20
7200