تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
6519 أدوات العرض

I created a module named student_info in my openerp 7 and the it has been installed successfully and is working fine now.The only issue is the field labels in the formview of the module is not displayed.What might be the reason for this.I searched for a long but the solution is not yet available.The module files are

_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':'' }

student_info.py from openerp.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',required = 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 <openerp> <data>

<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>

<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="percent"/> <field name="gender"/>
<field name="active"/> </tree> </field> </record>

<record id="student_student_form" model="ir.ui.view"> <field name="name">student.result.form</field> <field name="model">student.student</field> <field name="arch" type="xml"> <form string="Student_result" version="7.0">
<field name="name"/>
<field name="age"/> <field name="percent"/> <field name="gender"/>
<field name="active"/> <field name="notes"/> </form> </field> </record>

<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>

<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>

الصورة الرمزية
إهمال
أفضل إجابة

Hi Sneha,

In your xml you have given version="7.0" attribute in form tab. So you have to put fields in group after that you will be able to see field's label in form view.

<group>
    <group>
        #Define your fields
    </group>
<group>

If you remove version="7.0" then group is not required.

After changing the xml you have to update your module.

Hope this will help you.

الصورة الرمزية
إهمال
الكاتب

Thanks Sudir..It worked perfectly

الكاتب

have another issue .I want to add a grid view in the 'Create' form view having columns containing date fields and status with 'Add New Item' option.What all changes should I make in the code?

أفضل إجابة

Hi Try this code:
<record id="student_student_form" model="ir.ui.view"> <field name="name">student.result.form</field> <field name="model">student.student</field> <field name="arch" type="xml"> <form string="Student_result" version="7.0"> <sheet> <group> <field name="name"/> <field name="age"/> <field name="percent"/> <field name="gender"/> <field name="active"/> <field name="notes"/> </group> </sheet> </form> </field> </record> Thanks

الصورة الرمزية
إهمال
الكاتب

Thanks for the code.It worked

الكاتب

have another issue .I want to add a grid view in the 'Create' form view having columns containing date fields and status with 'Add New Item' option.What all changes should I make in the code?

You need to add one2many relation with your cutome object.

الكاتب

how to add object relation and relation id in a one2many type?if my model is student.student how to find the object relation and relation id for the model

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يونيو 23
7226
3
مارس 24
17142
V17 Tree, Form view تم الحل
1
مارس 25
1267
1
يوليو 24
1729
1
يناير 24
4747