How to do it...

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:

  1. Edit the __manifest__.py file to declare a new data file:
    data: [ 
        # ...Security Groups 
        'security/ir.model.access.csv', 
        # ...Other data files 
    ]
  1. 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset