my_module should already contain the models/library_book.py Python file creating the library.book model. We will now add a data file describing 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 to the module a new security/ir.model.access.csv file, with the following lines:
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,
perm_unlink access_library_book_user,library.book.user,model_library_book,
base.group_user,1,0,0,0 access_library_book_admin,library.book.admin,model_library_book,
base.group_system,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 in to a demonstration database using the demo user, we should be able to access the Library menu option without any security errors.