Adding security access to models

It's common for add-on modules to add new models. For example, in Chapter 4, Creating Odoo Add-On Modules, we added a new Library Books model. It is easy to miss the creation of security access for new models during development, and you might find it hard to see menus and views that have created, because, from Odoo version 12, admin users don't get default access rights to new models. In order to see views and menus for the new model, you have to need to add security Access-Control Lists (ACLs).

However, models with no ACLs will trigger a warning log message on loading, informing the user about the missing ACL definitions:

WARNING The model library.book has no access rules, consider adding one example, access_library_book, access_library_book, model_library_book, base.group_user,1,0,0,0

You can also access newly added models through a superuser, as this bypasses all security rules. To learn more about this, please refer to the Accessing Odoo as a superuser recipe from Chapter 4, Creating Odoo Add-On Modules. The superuser feature is only available for administrator users. So, for new models to be usable by non-admin users, we need to define their access control lists so that Odoo knows how it should access them and what operations each user group should be allowed to perform.

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

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