Through clicking a button the user should create a new order from given values and be directly redirected to the form view of the newly created order. Following method is called through the button:
@api.one
def method_name(self):
[...]
vals = [...]
new_order = self.env['sale.order'].create(vals)
self.write({ 'state': 'review', })
return {
'type': 'ir.actions.act_window',
'name': 'sale.view_order_form',
'res_model': 'sale.order',
'res_id': new_order.id,
'view_type': 'form',
'view_mode': 'form',
'target' : 'self',
}
Sadly nothing happens and I have no clue, what to try next. I tried to change the target to new
or current
or the name but nothing changes. Both without success.
Edit: see my comment on Carlos' answer.