Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
2122 Lượt xem

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)

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.


Ảnh đại diện
Huỷ bỏ

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 6 25
4737
2
thg 1 25
2525
1
thg 12 20
7515
0
thg 8 19
3894
1
thg 7 24
1901