my_library should already contain the models/library_book.py Python file that creates the library.book model. We will now add a data file that describes this model's security access control by performing the following steps:
- Edit the __manifest__.py file to declare a new data file:
data: [ # ...Security Groups 'security/ir.model.access.csv', # ...Other data files ]
- Add a new security/ir.model.access.csv file to the module with the following lines:
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
acl_book,library.book_default,model_library_book,base_group_user,1,0,0,0
acl_book_librarian,library.book_librarian,model_library_book,group_library_librarian,1,1,1,1
We should then upgrade the module to have these ACL records added to our Odoo database. More importantly, if we sign into a demonstration database using the demo user, we should be able to access the Library menu option without any security errors.