Odoo Help


including a field from an inherited module

on 5/13/13, 8:21 AM 3,688 views

Hi everyone,i modify the module rh and now i want to add a field many2one in an other module from employee who have a job professor but i have this error:

ValueError: Invalid field u'job_id.name' in leaf "<osv.extendedleaf: (u'job_id.name',="" u'=", u" prof')="" on="" hr_job="" (ctx:="" )&gt;"<="" p="">

code of the file.py

enter code hereclass school_matiere(osv.osv):
''' matiere '''
_description ='Information sur les matieres'
_name = 'school.matiere'

_columns = {
    'name': fields.char('libelle matiere', size=64, required=True, select=1),
    'code': fields.char('Code matiere', size=20, required=True, select=1),
    'coef_mat': fields.integer('coefficient matiere'),
    'teacher_id': fields.many2one('hr.employee', 'Professeur responsable',required=True),


code of file.xml

enter code here<record model="ir.ui.view" id="view_school_matiere_form">
        <field name="name">school.matiere.form</field>
        <field name="model">school.matiere</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Matiere" version="7.0">
                <group col="6" colspan="4">
                <field name="teacher_id" domain="[('job_id.name','=','prof')]"/>
                    <field name="name" />
                    <field name="code" />
                    <field name="coef_mat" />

ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
| 6 5 8
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd.
On 5/13/13, 9:51 AM


your Domain expr... is wrong as .. you are searching in hr.jobs, there is no field name "job_id" that's why you are getting this error

try this ...

<field name="teacher_id" domain="[('job_id.name','=','prof')]"/>

the above example only for those records which contents value 'prof' in name field means those records will be displayed where name='prof' you can use according to you....

Hi it worked at the beginning but now i find the value "prof" and not the employee who i want to select...any idea please

on 5/15/13, 8:16 AM

in the module hr.job which records contents value 'prof' in the name field , those records will be display ... can you tell what actually you want , what kind of employee you want in search

ClueLogics Technologies Pvt. Ltd.
on 5/15/13, 8:35 AM

I want to display employees who have the job 'teacher (in the HR module) in another module that I developed via the field many2one (the code above)

on 5/15/13, 8:39 AM

where you want to display , this is an example of , when you select teacher_id in employee

ClueLogics Technologies Pvt. Ltd.
on 5/15/13, 8:43 AM

here in school.matiere module you are not display employee you are display hr.job means job position .. where name='prof'

ClueLogics Technologies Pvt. Ltd.
on 5/15/13, 8:45 AM

exactly but teacher_id is in another class

on 5/15/13, 8:45 AM

ok now , do one think , 'teacher_id': fields.many2one('hr.employee', 'Professeur responsable',required=True), not hr.job ... and then in domain add your previous think means ... ....... &lt;field name="teacher_id" domain="[('job_id.name','=','prof')]"/&gt; ... then it will run perfectly as you want

ClueLogics Technologies Pvt. Ltd.
on 5/15/13, 8:47 AM

i updated your code in your Q you can copy this code now it will run perfectaly

ClueLogics Technologies Pvt. Ltd.
on 5/15/13, 8:52 AM

i have this error: ValueError: Invalid field u'job_id.name' in leaf "<osv.ExtendedLeaf: (u'job_id.name', u'=', u'prof') on hr_job (ctx: )>"

on 5/15/13, 8:54 AM

yes thank you it work's now...I had to create a new database and restart service

on 5/15/13, 9:04 AM
On 5/13/13, 8:42 AM

it work's now i just modify hr.employee by hr.job in the field

'teacher_id': fields.many2one('**hr.job**', 'Professeur responsable',required=True),

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 5/13/13, 8:21 AM
Seen: 3688 times
Last updated: 3/16/15, 8:10 AM