Skip to Content
Menu
This question has been flagged
1 Reply
3030 Views

I am using odoo 10 enterprise . I am trying to set default value as logged in user, i know how to do that 

https://www.odoo.com/forum/help-1/question/how-to-assign-the-logged-in-user-as-a-default-value-45339

above link also describe this but in addition to this i want to set a condition that i want to set this manually from default if the logged in user is admin or suppose some specific user otherwise user will select from drop-down while creating record in form view.

Note : I have created field as many2one and added filter on that drop-down so that filtered user show-up only in drop-down

Avatar
Discard
Best Answer

If you want to give default value based on a condition use 

your_field = fields.Many2one('res.user', string="your field", default=any_function)

then in the function

def any_function(self):
if your group in self.env.user.groups_id :


Avatar
Discard
Related Posts Replies Views Activity
0
Oct 22
938
0
Nov 19
2505
6
Aug 19
3383
3
Feb 19
6172
1
Aug 18
3163