Odoo Help


3 Answers



| 6 4 8
Zagreb | Karlovac, Croatia

there is only 10 kind of people the ones that understand binary ... and others

2014/07/15 10:03

Well.. you are looking at wrong data.. 

In odoo/openerp resource_resource contains(actualy is hr_employee name i related to this field) 
 the name for employees, not users.. 

there is a table res_users where some user data is stored... (login, password, mail.. etc..) and a relation to res_partner (partner_id) wich contains actual name of user, along with other data (address, phone , mail....)

So eather you rewrite your sql acordingly (using some joins for foreign key ids..) ,

or.. simply user orm methods like.. if you want to search for user wich has login : 'someuser' it would look like:

ids = self.pool.get('res.users').search(cr, uid, [('login'.'=','someuser')])    #expecting a list of ids returned

now that you have list of ids, you can browse those records and read/modify any data stored in fields...


but in your case... i think it would be much easier if you do not use fields.selection.. but instead, 

define your:

_columns = {

this is common usage for many to one field, and it preserves most orm methods in it ( addins and modifying user) 
in case you want to show just a selection on the view... define a view like: (addon after comment:)
<field name="my_user" widget="selection" /> 

If you need only a few fields shown and not the default view for related field, define them in the same view like:

<field name="my_user" widget="selection" > 
        <field name="first_name"/>
        <filed name="last_name"/>


2014/07/17 3:03

Thank you. I solved this isue in the next way:

_columns = {


'user_id': fields.many2many('res.users'),




but in the xml view I inserted this string


<field name="user_id" string='Assigned Users' widget="many2many_tags" />

2014/07/16 0:24

HI. Andrew 

Here right way TODO.

_columns = {

          'user_id': fields.many2one('res.users', 'Salesperson',),


_defaults = {
         'user_id': lambda obj, cr, uid, context: uid,


I suggest you to read existing code of sale module or account module, and just go through code and understand existing codes and utilize it in your modules.


Ask a Question
Keep Informed
2 follower(s)
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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now