Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
8886 Zobrazení

Hello,

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď

You cannot. The return by defition is only 1.

Avatar
Zrušit
Autor

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.

Nejlepší odpověď

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
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
dub 23
1592
1
bře 15
6295
1
bře 24
3477
4
bře 22
5252
3
říj 20
7555