تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
5067 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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.

الصورة الرمزية
إهمال
الكاتب

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

أفضل إجابة

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?


الصورة الرمزية
إهمال
الكاتب

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.

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يناير 24
3773
2
يوليو 24
15789
2
سبتمبر 23
8622
2
مايو 23
3004
1
أبريل 23
2912