コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
11280 ビュー

I have a button in a wizard, and what I need when I click it, keep the wizard opened. (Odoo 13)

アバター
破棄
著作者 最善の回答

I resolved it in an easy way, just returned the same wizard in a new action like this:

## here I change what I need example:

self.my_field_ids = [(6, 0, my_values_ids)]
return {
'name': 'Same title',
'view_mode': 'form',
'view_id': False,
'res_model': self._name,
'domain': [],
'context': dict(self._context, active_ids=self.ids),
'type': 'ir.actions.act_window',
'target': 'new',
'res_id': self.id,
}
アバター
破棄

Nice!

最善の回答

More appropriate way to make this happen is this and it will not close the wizard

return { 
'type' : 'ir.actions.do_nothing'
}
アバター
破棄

It works in back dates

最善の回答
It works for me:

action = self.env["ir.actions.actions"]._for_xml_id("current_model.current_action")
action['res_id'] = self.id
return action


アバター
破棄
最善の回答

If I'm not mistaken previously it was possible with the attribute special='string', e.g.:

<button name="do_stuff" type="object" string="Do Stuff" class="oe_highlight" special="string"/>

Be cautious: (even if it helped) the object would not be saved before the button is triggered. For example, some of compute, inverse, create/write method would not have take a place. Thus, the behavior would be different in comparison to normal button, some figures might be not yet calculated.

Alternatively, it should be done by adding JavaScript event handlers.

アバター
破棄
著作者

thank you for your answer.

関連投稿 返信 ビュー 活動
1
4月 24
2183
0
11月 23
1156
1
9月 23
1158
2
8月 23
3262
2
4月 23
31059