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

I have used 'flags': {'initial_mode': 'edit'} to open record in edit mode in Odoo 10.


but its not working in odoo 12. Do we have any alternative of this.

res = {
    'name': action.name,
    'help': action.help,
    'type': action.type,
    'views': [(form_id, 'form')],
    'view_mode': 'action.view_mode',
    'target': action.target,
    'context': action.context,
    'res_model': action.res_model,
    'flags': {'initial_mode': 'edit'},
    'res_id': record.id
}
形象
丢弃
最佳答案

Hello 

pass the context like below code and check.

context = dict(self.env.context)
context['form_view_initial_mode'] = 'edit'
return {'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.mass_mailing',
    'res_id': mass_mailing_copy.id,
        'context': context,
}

I hope this will helps you.

形象
丢弃
编写者

Worked.Thanks

最佳答案

Hi,

Send it via the context. This works for me on v12;

return {            'type': 'ir.actions.act_window',            'name': 'Helpdesk Ticket',            'view_type': 'form',            'view_mode': 'form',            'res_model': self._name,            'res_id': self.id,            'context': {'form_view_initial_mode': 'edit'},            'target': 'current',        }
形象
丢弃
编写者

thanks for your answer.

相关帖文 回复 查看 活动
2
2月 23
3613
1
11月 19
11737
7
7月 19
4853
0
2月 21
3018
3
3月 24
6950