How to do it...

To add new access security groups to a module, perform the following steps:

  1. Ensure that the __manifest__.py addon module manifest has the category key defined:
    'category': 'Library', 
  1. Add the new security/library_security.xml file to the manifest data key:
    'data': [ 
        'security/library_security.xml', 
        'views/library_book.xml', 
    ], 
  1. 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> 
  1. 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.

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

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