Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
5083 Weergaven

I have 5 Level approvals in my custom module function.I define inverse attribute for my state field and based on changing state i write function in that inverse function.When i calling self.env.user from that inverse function i will always shows as Super admin user even i log in different user.Please help me to fix this

Avatar
Annuleer
Beste antwoord

Make sure you are not calling the methods inside "sudo".

e.g. If you are calling a method 'confirm_order' though sudo, the 'confirm_method' is going to see env.user as SUPERUSER.

Avatar
Annuleer
Auteur

Thank you so much..I was stucked almost 1 week for finding this issue.

Beste antwoord

Hi,

if you need id, get it like self.env.user.id

could you check self.env.user.name to check if you logged in as user A?


Avatar
Annuleer
Auteur

I checked that,but i always get Super user

This usually happens when the model is created as superuser using sudo() method. First the non admin user have the proper access rights to create records in that model.

Gerelateerde posts Antwoorden Weergaven Activiteit
1
jan. 24
3791
2
jul. 24
15800
2
sep. 23
8628
2
mei 23
3022
1
apr. 23
2917