- Odoo 11 Development Cookbook(Second Edition)
- Holger Brunn Alexandre Fayolle
- 168字
- 2021-06-25 22:48:44
How it works…
We are providing two new data files that we add to the addon module's manifest so that the installation or update of the module will load them in the database:
- The security/groups.xml file defines a new security group by creating a res.groups record.
- The ir.model.access.csv file associates permissions on models with groups. The first line has an empty group_id:id column, which means that the rule applies to everyone. The last line gives all privileges to members of the group we just created.
The order of the files in the data section of the manifest is important; the file creating the security groups must be loaded before the file listing the access rights, as the access right's definition depends on the existence of the groups. Since the views can be specific to a security group, we recommend putting the group's definition file in the list to be on the safer side.
More information on security is available in the recipes from Chapter 11, Access Security.