2014-04-11 77 views
0

我正在嚮導,問題是我沒有得到那彈出屏幕。如何創建奇才openerp?

from osv import fields, osv 

import datetime 

class wiz_file(osv.osv_memory): 

    _name = 'wiz_test' 
    _columns = { 
       'dob':fields.date('Date of birth'), 
       'name':fields.char('Name', size=30), 
       'gender':fields.selection([('female','Female'), ('male','Male')], string='Gender'), 
       } 


    _defaults = {} 

    def wizfun(self, cr, uid, ids, context=None): 
     res=self.pool.get('client.client') 
     dt = res.cp1val() 
     if dt > 0: 
      print "GREATER" 
     else: 
      raise osv.except_osv('CP1VAL less than 0') 
     return res  

wiz_file() 

------------------- XML ----------------

<record id="test_wizard" model="ir.ui.view"> 
    <field name="name">wiz_test_form</field> 
    <field name="model">wiz_test</field> 
    <field name="type">form</field> 
    <field name="arch" type="xml"> 
     <form string="wizard_form"> 
      <group col="8"> 
       <field name="name" string="NAME"/> 
       <field name="gender" string="GENDER"/> 
       <field name="dob" string="DATE OF BIRTH"/> 
      </group> 
      <button string="Cancel" special="cancel" icon="gtk-cancel"/> 
      <button string="Cleanup" name="cleanup" type="object" icon="gtk-ok"/> 
     </form> 
    </field> 
</record> 

<record id="acton_wizard" model="ir.actions.act_window"> 
    <field name="name">Wizards</field> 
    <field name="type">ir.action.act_window</field> 
    <field name="res_model">wiz_test</field> 
    <field name="view_type">form</field> 
    <field name="view_mode">form</field> 
</record> 

<act_window 
    id="action_test_wizard" 
    name="Test wizard" 
    res_model="wiz_test" 
    src_model="client.client" 
    view_type="form" 
    view_mode="form" 
    key2="client_action_multi" 
    target="new" 
    multi="True" 
    /> 

回答

1

如果你只是想在彈出打開向導的形式,那麼你就必須添加字段目標在你的行動:

<record id="acton_wizard" model="ir.actions.act_window"> 
    <field name="name">Wizards</field> 
    <field name="type">ir.action.act_window</field> 
    <field name="res_model">wiz_test</field> 
    <field name="view_type">form</field> 
    <field name="view_mode">form</field> 

    <field name="target">new</field> <!-- default is current --> 

</record>