Odoo 创建多步 wizard 向导your_wizard.xml
wizard_with_step.form
wizard_with_step
form
your_wizard.py
class wizard_with_step(osv.osv_memory):
_name = 'wizard_with_step'
_description = 'Wizard with step'
_columns = {
'name1': fields.char('Name 1',),
'name2': fields.char('Name 2',),
'state': fields.selection([('step1', 'step1'),('step2', 'step2')])
}
def action_next(self, cr, uid, ids, context=None):
#your treatment to click button next
#...
# update state to step2
self.write(cr, uid, ids, {'state': 'step2',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'your_wizard',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
def action_previous(self, cr, uid, ids, context=None):
#your treatment to click button previous
#...
# update state to step1
self.write(cr, uid, ids, {'state': 'step1',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'your_wizard',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
来源:苏州远鼎官网
相关标签 TAG : Odoo 多步wizard 向导 创建