Hello,
I would like to create a wizard with steps, which can merge my 3 views. Can you give me an example to realise that in Odoo 10 ?
Thank you.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I would like to create a wizard with steps, which can merge my 3 views. Can you give me an example to realise that in Odoo 10 ?
Thank you.
Create an account today to enjoy exclusive features and engage with our awesome community!
Înscrie-te
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
I have recently created a wizard with steps. It can be quite ugly, especially if you need to pass data around.
Could you elaborate in more detail what you intend to do?
Hi bro,
I have 3 form view, and i want to make relation between them.
when the user click in form 1 , then he click in next and he find form 2 , then next form 3
You can open a new wizard from a python function (that could be bound to a button press) by returning a dictionary:
return {
'name': _('Your window title'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'MODEL_NAME_OF_THE_NEXT_STEP',
'view_id': self.env.ref('VIEW_YOU_WANT_TO_USE').id,
'target': 'new',
'nodestroy': True,
}
In case you want to share data between the steps, you can create the new wizard before the return via:
next_step = self.env['WIZARD_NEXT_STEP'].create({
'param1': value1,
'param2': value2
})
and pass its id in the returned dictionary by adding the key:
'res_id': next_step.id
Thank you so much Dan. I have question about the second step,
next_step = self.env['WIZARD_NEXT_STEP'].......
what i should do in "WIZARD_NEXT_STEP " ?
Where i should put 'res_id' ?
WIZARD_NEXT_STEP is the name of the wizard that should be launched when you click the next step button. And 'res_id' should be put into the dictionary that is retuned by the python function that is executed when you click the next step button. In a nutshell:
@api.multi
def next_step_action(self):
# your logic here:
next_step = self.env['WIZARD_NEXT_STEP'].create(# parameters here
)
return {
'name': _('Your window title'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'MODEL_NAME_OF_THE_NEXT_STEP',
'res_id': next_step.id,
'view_id': self.env.ref('VIEW_YOU_WANT_TO_USE').id,
'target': 'new',
}
What i should do in the xml file ? how ii can use this wizard in my xml ?
You have to define a view record for each wizard step (if they should look different) and add a button into the view via:
<button name="next_step_action" type="object"
string="Next step" class="oe_highlight"/>
which will launch the next_step_action() function of the current wizard.
To make the wizard accessible from the outside, you'll also have to include a launch option somewhere (e.g. in the side menu or in some other view)