Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
1937 Tampilan

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)

Avatar
Buang
Penulis Jawaban Terbai

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....

Avatar
Buang
Jawaban Terbai

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



Avatar
Buang
Jawaban Terbai

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.


Avatar
Buang

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

Post Terkait Replies Tampilan Aktivitas
2
Jun 25
4567
2
Jan 25
2388
1
Des 20
7219
0
Agu 19
3752
1
Jul 24
1686