Odoo 创建多步 wizard 向导


Odoo 创建多步 wizard 向导

www.chinamaker.net 2016-04-27 18:50:13 admin

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  向导    创建  


苏州远鼎

运用前沿科学技术,苏州远鼎信息技术有限公司以开源管理软件产品为核心,为企业和政府组织提供软件及服务,是OpenERP(Odoo)专业服务商,中国开源管理软件服务市场的领跑者。

Read More

远鼎产品

联系远鼎

  • 苏州工业园区星湖街328号22栋301
  • +86-0512-69361217
  • odoo@chinamaker.net
  • www.chinamaker.net