To call a wizard from a button in a form view in Odoo, you can use the ir.actions.act_window model and the ir.ui.view model.
First, you need to create an action that will open the wizard when the button is clicked. You can do this by creating a new record in the ir.actions.act_window model, like this:
action = self.env['ir.actions.act_window'].create({
'name': 'Wizard',
'res_model': 'my.wizard',
'view_mode': 'form',
'target': 'new',
})
Next, you need to create a button that will trigger the action when it is clicked. You can do this by using the ir.ui.view model to create a new button in the form view, like this:
view = self.env['ir.ui.view'].create({
'name': 'My Button',
'model': 'my.model',
'type': 'form',
'arch': """
""" % action.id,
})
This will create a button at the top of the form view that will open the wizard when it is clicked.
To add the button after a specific field, you can use the xpath attribute of the button element to specify the position of the button in the form view. For example, to add the button after the name field, you could use the following arch: