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

I want to replace the existing access right of a model for a specific group with my own. I don't want to make changes in the base modules and want to achieve this by making changes in my own custom modules. Any good approach for this?

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

Hi,

You can override that by inheritance by defining security file in your custom module, for that you have to do:-

- create a 'security' folder and 'ir.model.access.csv' in your custom module.

- make sure you added that file path in " openerp.py " file

- For better understanding we can take an Example. Let us assume that you want to change security access right in 'hr' module

access_hr_employee_user,hr.employee user,model_hr_employee,base.group_hr_user,1,1,1,1

- for changing this you have to define new access right in your module like this:-

hr.access_hr_employee_user,hr.employee user,model_hr_employee,base.group_hr_user,1,0,0,0 


Hope this helps....

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

I tried it in odoo 9 community, but i'm getting following error:  "no  dataset found for external id 'model_hr_employee' in field Object"


my code:

hr.access_hr_employee_user,hr.employee user,model_hr_employee,base.group_hr_user,1,0,0,0
hr.access_hr_department_user,hr.department.user,model_hr_department,base.group_hr_user,1,0,0,0
Ảnh đại diện
Huỷ bỏ

i got it: you've got to inherit the model thingy as wel, like so:

[...] hr.model_hr_employee,base.group_hr_user,1,0,0,0

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 25
1389
0
thg 8 25
1376
0
thg 12 20
3219
2
thg 6 20
17687
0
thg 12 18
2879