跳至内容
菜单
此问题已终结
1 回复
2151 查看

good morning , please i want to know how to open a form view of an other model on a new tab of the the browser by clicking on a button and passing context 

形象
丢弃
最佳答案

Hi,

Insert the following code into the action triggered by your button click event:

return {

            'name': 'New',

            'type': 'ir.actions.act_window',

            'view_type': 'form',

            'view_mode': 'form',

            'res_model': 'your.model',

            'res_id': self.id,

            'context': {'default_module_id': self.id},

            'target': 'new'

        }

Make sure to replace 'your.model' and 'default_module_id' with the actual name of your model and the field you want to set a default value for, respectively.


Hope it helps

形象
丢弃
相关帖文 回复 查看 活动
5
9月 24
3461
1
1月 24
1441
0
3月 24
1673
1
10月 22
3305
0
8月 22
3224