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.

0

auto fill salesperson field when creating new customer [Closed]

By
Hanzo Chin
on 12/6/13, 4:35 PM 1,523 views

The Question has been closed

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

Hi,

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

0

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

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
0
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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 12/6/13, 4:35 PM
Seen: 1523 times
Last updated: 3/16/15, 8:10 AM