This question has been flagged
2 Replies
7003 Views

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
Discard
Best Answer

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
Discard
Author

Worked.Thanks

Best Answer

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
Discard
Author

thanks for your answer.