2014-02-28 74 views
1

我創建了一個包含模塊中所有四個文件的樣本模塊。該模塊已安裝在opt/openerp/server/openerp/addons的addons文件夾中使用Ubuntu)。該文件夾被顯示在插件文件夾列表以及在所安裝的模塊list.When我試圖安裝模塊無效架構誤差被示出爲在驗證字段(發生驗證openerp中的arch字段時視圖體系結構的XML無效

        ValidateError 

錯誤s)arch:View Architecture的XML無效! 我的編碼是顯示在下面

初始化的.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':'' 
} 

student_info.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_vie w.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> 

什麼是與編碼的問題?任何人都可以請給我更正後的代碼

回答

4

看到這,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"/> 

希望這會對你有幫助。讓你更多的發生任何問題。

+0

你試過了嗎? –

+0

yes.i試過了,問題解決了。 – user3363475

相關問題