Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
1939 Widoki

Hey,

I want the user to be able to see a form (of the sale.order model) despite not having write access.

I have managed to give him read access with no write access based on some custom Record Rules, but despite having read access he cannot enter and see the form. What I was expecting is for him to be able to see the form and get the "denied error" when clicking on the "Edit" button

What am i missing?


Many thanks guys I have been searching, reading docs, watching yt videos for days to achieve my goal still failing (though learning a lot about security, groups, access rights, etc)

Awatar
Odrzuć
Autor Najlepsza odpowiedź

thanks, the scenario is:
sale.order has two groups: admin and regular user.
At first both users should be able to CRUD the sale.order. Afterwards only admins can mark the sale.order as "done", once it reaches this state, then regular users should not have write permissions on sale.order anymore. 

I have done this with Record Rules, on regular user's group:

Rule 1, sale.order, read, create and delete

Rule 2, sale.order, write if sale.order.state != "done"

But as I said before, once sale.order.state == "done", the regular user cannot open (read) the sale.order form cause it shows a Denied write error....

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

1. Go to settings->user & companies -> Group-> create

2. Select the application as sale 

3. select the users

4. set the access right -> model (sale)-> Tick the read access only


You can refer to the YouTube video on Security in Odoo 16: Groups and Access Rights in Odoo | Odoo 16 Development Tutorials

https://www.youtube.com/watch?v=PmSepSujsBk


Hope it helps



Awatar
Odrzuć
Najlepsza odpowiedź

Not sure whether this is practical for you, but you could copy the Form View and amend the XML to make the Form Read-only.  Authorize some users to only the new menu option running the updated form view.


Awatar
Odrzuć

 <form string="Sales Order" edit="0" class="o_sale_order">

Powiązane posty Odpowiedzi Widoki Czynność
2
cze 25
4567
2
sty 25
2388
1
gru 20
7219
0
sie 19
3757
1
lip 24
1689