Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Custom addon access rights

By
Ucet Kxud
on 7/22/14, 11:02 AM 1,768 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?

 

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

Ucet Kxud
on 7/23/14, 5:23 AM
0
klacus
On 7/22/14, 11:47 AM

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)

 

 

 

0
Ucet Kxud
On 7/23/14, 5:52 AM

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

I refresh my answer. Bye.

klacus
on 7/23/14, 11:03 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/22/14, 11:02 AM
Seen: 1768 times
Last updated: 3/16/15, 8:10 AM