跳至内容
菜单
此问题已终结
2 回复
5087 查看

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
1月 24
3811
2
7月 24
15811
2
9月 23
8632
2
5月 23
3028
1
4月 23
2947