Skip to Content
Menu
This question has been flagged
1576 Views

I made a user group that have access to a read and create operation on a Users model. But when user with that group is trying to create new user there is an error that he does not have access to write operation. 

https://i.imgur.com/fDGiJdf.png

Why when I'm creating something there is also necessary to have write privelage?

Access rights:

https://i.imgur.com/5iLhKeI.png

Record rules:

https://i.imgur.com/rky9y70.png

Avatar
Discard

If the user can create, then you give him write access as well. Because when you create a record, the write method is called too. You can check this by adding a print to write and try then to create a record.

Author

But why write is called too? What is the point to have crate and write access splited up in that case? I want users only to create new ones and not to edit existing ones (because then they can change admin passowrd).

You could hide the admin user from the other users, overriding the search method of res.users, you can use self.env.user.id == SUPERUSER_ID then append to the domain ('id' ,'!=', self.env.user.id).

But you should verify your logic, if you create an user, you should be able to edit that user.

Sorry, the condition is if self.env.user.id != SUPERUSER_ID then append to the domain('id', '!=', SUPERUSER_ID)

Author

But where do I put this?

And I need to protect not only one superuser but also other users with high privileges. I simply don't want users to edit others with the same or higher privileges. And the simples solution would be to deny write access but odoo is broken and calls it when it shoudn't.

Related Posts Replies Views Activity
2
Dec 23
12010
0
Oct 23
33
3
Oct 23
787
1
Oct 23
569
1
Aug 23
982