To add new access security groups to a module, perform the following steps:
- Ensure that the __manifest__.py addon module manifest has the category key defined:
'category': 'Library',
- Add the new security/library_security.xml file to the manifest data key:
'data': [ 'security/library_security.xml', 'views/library_book.xml', ],
- Add the new XML file for the data records at security/library_security.xml, starting with an empty structure:
<?xml version="1.0" encoding="utf-8"?> <odoo> <data noupdate="0"> <!-- Data records go here --> </data> </odoo>
- Add the record tags for the two new groups inside the data XML element:
<record id="group_library_user" model="res.groups"> <field name="name">User</field> <field name="category_id" ref="base.module_category_library"/> <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> </record> <record id="group_library_manager" model="res.groups"> <field name="name">Manager</field> <field name="category_id" ref="base.module_category_library"/> <field name="implied_ids" eval="[(4, ref('group_library_user'))]"/> <field name="users" eval="[(4, ref('base.user_root'))]"/> </record>
If we upgrade the addon module, these two records will be loaded, and we will be able to see them at the Settings | Users | Groups menu option.