Odoo Help


auto fill salesperson field when creating new customer [Closed]

Hanzo Chin
on 12/6/13, 4:35 PM 2,050 views

The Question has been closed

Sudhir Arya (SA)
on 12/09/2013 08:07:33


How do I set the salesperson field in res.partner to be auto-fill with logger ID?

Sudhir Arya (SA)
On 12/7/13, 11:25 AM

_defaults is used to set a value by default.

To set current user's id try the following code:

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

Hope this will help you.

sorry for my bad, where to set it for res.partner? in res_partner.py?

Hanzo Chin
on 12/8/13, 10:34 AM

If you are not creating your custom module then you can add this code in res.partner object.

Sudhir Arya (SA)
on 12/9/13, 12:41 AM
Ashif Abdulrahman
On 12/9/13, 3:23 AM

use this in your _defaults

_defaults = {
      'user_id': lambda s, cr, uid, c: s._get_default_user(cr, uid, c)

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: 12/6/13, 4:35 PM
Seen: 2050 times
Last updated: 3/16/15, 8:10 AM