This question has been flagged
2 Replies
9638 Views

I am trying to create a custom addon in openerp v.7. I want to give read access rights to a group in my ir.model.access.csv:

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
test_access_hr_employee,test employee access,hr.employee,group_test_employee,1,0,0,0
test_access_hr_leave,test leave access,hr.holidays,group_test_employee,1,0,0,0

The first record for model hr.employee works fine, but when I add the second line for model hr.holidays I get the error Line 2 : No matching record found for external id 'hr.holidays' in field 'Object'

I have installed the leave management addon and I see the model hr.holidays in Technical - Database Structure - Models. Does anybody know why this happens?

 

Avatar
Discard
Author

Adding the module name doesn't seem to help...

Best Answer

As I know you should add the modul name in the permisson.

please see this, and just copy and modify what you want...:

access_hr_holydays_status_user,hr.holidays.status user,model_hr_holidays_status,base.group_hr_user,1,1,1,1
access_hr_holidays_user,hr.holidays.user,model_hr_holidays,base.group_hr_user,1,1,1,1
access_hr_holidays_employee,hr.holidays.employee,model_hr_holidays,base.group_user,1,1,1,1
access_hr_holydays_status_employee,hr.holidays.status employee,model_hr_holidays_status,base.group_user,1,0,0,0
access_hr_holidays_remain_user,hr.holidays.ramain.user,model_hr_holidays_remaining_leaves_user,base.group_hr_user,1,1,1,1
access_resource_calendar_leaves_manager,resource_calendar_leaves_manager,resource.model_resource_calendar_leaves,base.group_hr_manager,1,1,1,1

  • id = unique identify for the permission (Example: MY_MODULE_res_partner_manager)
  • name = unique name for the permission (Example: res_partner manager)
  • model_id/id = the model unique name of the class you want apply permission on (Example model_res_partner)
  • group_id/id = group permission apply on (yopu can define it in xml group file or call an existing group with syntax module.group_id)
  • perm_read,perm_write,perm_create,perm_unlink = the 4 values for the relative permission to read, write,create,unlink record on defined class. 1 is True (you can do this action) and 0 is Faslse (you can't)

 

 

 

Avatar
Discard
Author Best Answer

I had to replace model name from 'hr.holidays' to 'model_hr_holidays'. I am n00b, I don't understand why I had to do that. Maybe someone is kind enough to explain...

Avatar
Discard

I refresh my answer. Bye.