Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

View error Can't find field 'field name' in the following view parts composing the view of object model 'object name' [Closed]

By
Maath
on 5/25/13, 5:30 AM 3,928 views

The Question has been closed

by
Maath
on 06/16/2013 11:27:05

I have create new module and install it but when I wand to create new contract and click this Error appear .. Why??

View error

Can't find field 'x_salary_ids' in the following view parts composing the view of object model 'hr.contract': * hr.contract.view.form

Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model

My fill codes

__init__.py

import sim77

__openerp__.py

{ 'name': 'Student Information Management',

'version': '0.1',

'category': 'Tools',

'description': """This module is for the Student Information Management Testing.""",

'author': 'Maath Programmer',

'website': 'http://mirnauman.wordpress.com/',

'depends': ['base','hr','hr_contract'],

'init_xml': [],

'update_xml': ['sim_view77.xml'],

'demo_xml': [],

'installable': True,

}

sim77.py

from osv import osv,fields

class hr_contract(osv.osv):

_inherit = 'hr.contract'

_name = "sim77.student"

_description = "This table is for keeping personal data of student"

_columns = {

'x_salary_ids': fields.one2many('sim77.student', 'contract_id', 'Tracabilite')

}

hr_contract()

class sim77_student(osv.osv):

_name = "sim77.student"

_description = "This table is for keeping personal data of student"

_columns = {

    'name': fields.char('Registration Number',size=256,required=True),

    'student_name': fields.char('Student Name',size=256,required=True),

    'gender':fields.selection([('male','female'),('female','Female')],'Gender'),

    'contact_no':fields.char('Contact Number',size=256),

    'contract_id': fields.many2one('hr.contract','RR'),

}

sim77_student()

sim_view77.xml

<openerp> <data> <record model="ir.ui.view" id="student_form"> <field name="name">Student</field> <field name="model">sim77.student</field> <field name="type">form</field> <field name="arch" type="xml">

<form string="Student"> <field name="name"/> <field name="student_name"/> <field name="gender"/> <field name="contract_id"/> </form>

</field> </record> <record model="ir.ui.view" id="student_tree"> <field name="name">Student</field> <field name="model">sim77.student</field> <field name="type">tree</field> <field name="arch" type="xml"> <tree string="Student"> <field name="name"/> <field name="student_name"/>

<field name="gender"/> <field name="contract_id"/> </tree> </field> </record> <record model="ir.actions.act_window" id="action_student"> <field name="name">Student</field> <field name="res_model">sim77.student</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> </record> <menuitem name="SIM/Student/StudentInfo" id="menu_sim_student" action="action_student"/>

    <record id="hr_contract_view_form_in" model="ir.ui.view">
        <field name="name">hr.contract.view.form</field>
        <field name="model">hr.contract</field>
        <field name="inherit_id" ref="hr_contract.hr_contract_view_form"/> 
        <field name="arch" type="xml">
             <field name="wage" position="after">
                <field name="x_salary_ids" nolabel="1" >
                        <tree string="Salary">
                            <field name="name"/>
                            <field name="student_name"/>

                            <field name="gender"/>
                            <field name="contract_id"/>

                        </tree>
                        <form>
                            <field name="name"/>
                            <field name="student_name"/>

                            <field name="gender"/>
                            <field name="contract_id"/>                         
                        </form>
                    </field>
            </field>
        </field>
    </record>

</data> </openerp>

can anyone check my code and why this error appear and how to resolve the problem Please .....

4

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--
4136
| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 5/25/13, 11:08 AM

hi,

in class hr.contract you have _name = "sim77.student" and _description = "This table is for keeping personal data of student", remove this 2 lines, restart openerp server and retry.

Bye

Many thanks GEM

Maath
on 5/25/13, 11:24 AM

thank you GEM

samba
on 7/24/14, 7:27 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/25/13, 5:30 AM
Seen: 3928 times
Last updated: 3/16/15, 8:10 AM