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

I want to open a form view in a popup but not in editable mode. The form view should be in saved mode and not in edit mode.

Normally when we open a form in a popup, it always shows the popup in editable mode.

def action_view_product(self):
return {
'type': 'ir.actions.act_window',
'name': 'Products',
'view_mode': 'form',
'view_type': 'form',
'res_model': "product.template",
'res_id': self.id,
'target': 'new',
}


アバター
破棄
最善の回答

Pass 'flags': {'initial_mode': 'view'} in the action to open the form in non-edit mode.

Try the following code:

return {
'type': 'ir.actions.act_window',
'name': 'Products',
'view_mode': 'form',
'view_type': 'form',
'view_id': view.id,
'res_model': "product.template",
'res_id': self.id,
'target': 'new',
'flags': {'initial_mode': 'view'}
}


アバター
破棄
著作者

Thanks! It worked :)

関連投稿 返信 ビュー 活動
1
8月 25
213
1
8月 25
134
0
8月 25
138
1
8月 25
312
3
8月 25
307