gpt4 book ai didi

python - 在 openerp 中验证 arch 字段时, View 架构的 XML 无效

转载 作者:行者123 更新时间:2023-11-30 23:27:24 25 4
gpt4 key购买 nike

我创建了一个示例模块,其中包含模块中的所有四个文件。该模块已安装在 opt/openerp/server/openerp/addons 的 addons 文件夹中(我正在使用 ubuntu)。该文件夹显示在插件文件夹列表以及已安装的模块列表中。当我尝试安装该模块时,无效架构错误显示为

                                 ValidateError

验证字段 arch 时发生错误: View 架构的 XML 无效!我的编码如下所示

init.py

 import student_info

openerp.py

{
'name':'Student Information',
'version':'7.0',
'author':'Sneha Elizabeth Antony',
'depends':['base'],
'Category':'General',
'description':'This module contains the information about the students ie name,age,gender etc',
'init_xml':[],
'update_xml':['student_info_view.xml'],
'demo_xml':[],
'active':'False',
'installable':'True',
'Certificate':''
}

学生信息.py

from osv import osv,fields

class student_student(osv.osv):

_name = 'student.student'

_columns = {
'name':fields.char('Student Name',size=16,required = True,translate = True),
'age':fields.integer('Age',readonly = True),
'percent':fields.float('Percentage',help = 'This field will add average marks of students out of 100'),
'gender':fields.selection([('male','Male'),('female','Female')],'Gender'),
'active':fields.boolean('Active'),
'notes':fields.text('Details'),
}

_defaults = { 'name':'Atul',
'active':True,
}
student_student()

student_info_view.xml

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


<!--Student search view-->
<record model="ir.ui.view" id="student_search" >
<field name="name">student.search</field>
<field name="model">student.student</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string = "student information search">
<field name="name" string = "Student Name" />
<field name="gender" string = "Gender" />
<field name="age" string = "Age" />
</search>
</field>
</record>



<!--Student tree View-->
<record id="student_student_tree" model="ir.ui.view">
<field name="name">student.result.tree</field>
<field name="model">student.student</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Student_result">
<field name="name" />
<field name="age" />
<field name="percentage"/>
<field name="gender"/>
<field name="active"/>
</tree>
</field>
</record>


<!--Student Form View-->
<record id="student_student_form" model="ir.ui.view">
<field name="name">student.result.form</field>
<field name="model">student.student</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Student_result">
<field name="name" />
<field name="age" />
<field name="percentage"/>
<field name="gender"/>
<field name="active"/>
<field name="notes"/>
</form>
</field>
</record>

<!--Student Action-->
<record id="action_student_student" model="ir.actions.act_window">
<field name='name'>Student Information</field>
<field name='res_model'>student.student</field>
<field name='view_type'>form</field>
<field name='view_mode'>tree,form</field>
</record>


<!--Student Menu-->
<menuitem id="student_parent" name="student"/>
<menuitem id="menu_student_parent" name="Student Management" parent="student_parent"></menuitem>
<menuitem action="action_student_student" id="menu_student_student" parent="menu_student_parent" string="Result"/>
</data>
</openerp>

编码有什么问题?谁能给我正确的代码

最佳答案

看这个,id是一样的。在 OpenERP 中 id 必须是唯一的。因此,只需更改任何一个的 id 并使其唯一。

<menuitem id="menu_student_parent" name="Student Management"     parent="student_parent"></menuitem>

<menuitem action="action_student_student" id="menu_student_student" parent="menu_student_parent" string="Result"/>

希望这对您有帮助。让您更不会出现任何问题。

关于python - 在 openerp 中验证 arch 字段时, View 架构的 XML 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22088950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com