Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
8809 Vistas

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
}
Avatar
Descartar
Mejor respuesta

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.

Avatar
Descartar
Autor

Worked.Thanks

Mejor respuesta

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',        }
Avatar
Descartar
Autor

thanks for your answer.

Publicaciones relacionadas Respuestas Vistas Actividad
2
feb 23
3580
1
nov 19
11703
7
jul 19
4828
0
feb 21
2981
3
mar 24
6883