Odoo Help

3

0
10 Answers
3
Avatar

Manish Kumar Bohra India

--Manish Kumar Bohra--
11863
| 6 5 10
Bikaner, India
--Manish Kumar Bohra--


Manish Kumar Bohra India
10/1/18, 2:16 PM

I am solve this issue.. using this.

@api.one

def _get_current_login_user(self):

user_obj = self.env['res.users'].search([])

for user_login in user_obj:

current_login= self.env.user

if user_login == current_login:

self.processing_staff = current_login

return

1
Avatar

Niyas Raphy India

--Niyas Raphy--
27056
| 7 7 11
Wayanad, Kerala, India
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123
Whatsapp : +917736136763
Happy to help :)

Niyas Raphy India
2/6/18, 2:13 AM

Hi,

The code you have given seems to be fine.   As per this when you open the form you will get the current user in the field named user_id .

Can i know what exactly the problem is ?

Suppose if the admin is logged in and when you open a new form of that model,  in it you are getting the admin in that field  right ? Then just log out the admin and login as other user, now you will get that user's name in that field in new form right ?

Thanks

4 Comments
Manish Kumar Bohra India
2/6/18, 2:25 AM

Yes.. exactly.. @Niyas

Niyas Raphy India
2/6/18, 2:28 AM

the above explained is the expected behavior,

right now what you are getting

Manish Kumar Bohra India
2/6/18, 2:32 AM

just only show admin login but when i am login with another user than it's not reflected.

Manish Kumar Bohra India
2/9/18, 1:58 AM

Hello @Niyas,

I have done get current user id when form is draft state But my form is save than how to change current user id in my field.

0
Sehrish Pakistan
2/13/18, 4:27 AM

Why did you not do this using computed field. Crate a computed field with char type and assign the name of current user to that computed field.

1 Comment
Sehrish Pakistan
2/15/18, 5:45 AM
you are welcome :)

On Wed, Feb 14, 2018 at 11:59 AM, Manish Bohra <manishbohra1994@gmail.com> wrote:

thanks.. but my issue is solve.

--
Manish Bohra


Sent by Odoo S.A. using Odoo.


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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now