except_orm:('ValidateError',u'Error在验证字段时发生错误:视图架构的XML无效!')

时间:2014-07-07 12:07:02

标签: python-2.7 openerp-7

我创建了一个向导,现在它给了我上面的错误,它花了我很多年但却无法对它进行排序,我在Openerp中第一次做向导。请提前帮助谢谢。这是我的代码

class test_wizard(osv.osv_memory):
    _name="test.wizard"
    _description="will generate dynamic views, that's all"
    _columns={
              'age_text': fields.text('text age'),
    }

    def next(self,cr,uid,ids,contet=None):
        test_obj=self.pool.get('test.chbc')
        for wiz in self.browse(cr,uid,ids):
            if wiz.age_text <=5:
                raise osv.except_osv('user error, please slect something ,  know what')
            limit= datetime.date.today()-datetime.timedelta(days=wiz.age_text)
            ids_to_del=test_obj.search(cr,uid,[('create_date','<',
                                                limit.striftime('%y-%m-%d 00:00:00'))],context=context)
            test_obj.unlink(cr,uid,ids_to_del)
        return{}


test_wizard()

这是我的xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>  

    <record id="test_wizard" model="ir.ui.view">
        <field name="name">test.wizard.form</field>
        <field name="model">test.wizard</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Test wizard ">
                <label colspan="4" string="select age please , am in a hurry "/>
                <field name="age_text" string="Age(days)"/>
                <group col="4" colspan="4">
                    <button icon="gtk-cancel" special="cancel" string="Cancel"/>
                    <button icon="gtk-ok" name="next" string="Next" type="object"/>
                </group>
            </form>
        </field>
    </record>

    <record id="action_test_wizard" model="ir.actions.act_window">
        <field name="name">Next</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">test.wizard</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>


    </data>
</openerp>

1 个答案:

答案 0 :(得分:1)

更改模型名称意味着给出要放置它的类的名称

<field name="model">test.wizard</field>
相关问题