Odoo Help


Modify task->"Assigned to" from res.users to hr.employee

kobi segev
on 9/29/13, 10:23 AM 2,747 views

Im trying to figure out how to modify column properties of existing module. In this case, project tasks, should be assigned to employee and not user. The current column is: 'user_id': fields.many2one('res.users', 'Assigned to', track_visibility='onchange'), should be changed to: 'user_id': fields.many2one('hr.employee, 'Assigned to', track_visibility='onchange'),

I would like to override and not create new one in order to make use of the existing functionality around user_id.

Any thoughts on how it can be done?


This is my sample...

In your .py inherit the class you want to change the user id fro example

class class_name(osv.osv):
_inherit = "class.name"

_columns = {
    'user_id': fields.many2one('hr.employee, 'Assigned to', track_visibility='onchange'),

and in you .xml

  <record id="name_you_want" model="ir.ui.view">
        <field name="name">name.you.want</field>
        <field name="model">table.you.inherited</field>
        <field name="type">form</field>

        <field name="inherit_id" ref="table_you_inherited.name_of_the_form_where_you_want_to_change"/>
          <field name="arch" type="xml">

               <xpath expr ="//field[@name='user_id']" position="replace">
                    <field name="user_id" />

I hope it will work :D

It did the work. thanks for your help.

kobi segev
on 9/30/13, 3:30 AM

Your welcome :D i'm just sharing what i've learn, i also encounter that problem what i'm new to openerp :D

Lady Sharmane Udtuhan
on 9/30/13, 4:12 AM

Daniel Reis

--Daniel Reis--
| 7 8 9
Linda-a-Velha, Portugal
--Daniel Reis--

Author of the "Odoo Development Essentials" book.

Applications Manager at Securitas Portugal

Github: https://github.com/dreispt

Twitter; @reis_pt

Daniel Reis
On 9/30/13, 6:38 AM

That's similar to this other question.

I'll give you the same advice I gave there: create a User for each employee instead, and avoid unnecessary customizations.

I am assuming that. My problem is that i dont understand why user/employee is not the same entity at the first place (But one2many???). It gets event stranger (at least for tasks), when i need to manage employee timesheet, or filter by department (while selecting the user_id), it just doesn't adds up.

kobi segev
on 9/30/13, 7:52 AM

I agree, the HR data model has some important issues; another one is the confusing relation of Employees vs Partners. Let's hope all this is fixed in v8.

Daniel Reis
on 10/1/13, 7:55 AM

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: 9/29/13, 10:23 AM
Seen: 2747 times
Last updated: 3/16/15, 8:10 AM