Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Security Access Rights Error For a Custom Module

Subscribe

Get notified when there's activity on this post

This question has been flagged
5 Replies
21443 Views
Avatar
ABU K

I need to know how we can apply different access permission like

In Users->Access Rights-> Application (we can access different rights in modules like Sales,HR based on selection field(user,Manager) ) ,Same way I want to show my custom module under Application tab.

My module name = library_management_credatv (I want to set two level of access rights one is USer,admin How?)

Can you explain with a simple example

I tried from my side But I got this Error from my custom module ,

raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id)) ValueError: No such external ID currently defined in the system: library_management_credatv.group_training_user

This is My code---------------------------------------------------------------------------------------------------------

library_management_credatv  =module name

menu apllied  view.xml file  --------------

<menuitem id="main_library_menu_id" name="Library Mangement" sequence="0" groups="library_management_credatv.group_training_user"/>
 

.csv file------------------------------------------

id    name    model_id:id    group_id:id    perm_read    perm_write    perm_create    perm_unlink

 

access_training_category_user    library_management_credatv.category user    model_library_form

 

    library_management_credatv.group_training_user    1    1    1    1

 


access_training_idea_user    library_management_credatv.idea user    model_product_product

 

    library_management_credatv.group_training_user    1    1    1    1

 

 

 

 

training_security.xml-------------------


<?xml version="1.0" encoding="utf-8" ?>
<openerp>
    <data noupdate="0">
        
      <record model="res.groups" id="library_management_credatv.group_tool_user">
      
     <field name="name">Training User</field>
   <field name="category_id" ref="library_management_credatv.module_category_tools"/>
    
    
    </record>
    </data>    
</openerp>

 

 

 


openerp.py==============================

 

{
    'name':'Library Management',
    'version':'7.0',
    'author':'Me',
    'website':'http://www.test.com',
    'depends':['base','sale'],
    'category':'General',
    'description':'Library management  module',
    'data':[
            'book_info_view.xml',
            #'bookid_sequence.xml',
            'student_id.xml',
            'security/training_security.xml',
            'security/ir.model.access.csv',
            ],
    'demo':[]
}

 


.py file=======================================

 


from osv import osv,fields
import time

 

 

 


class product_product(osv.osv):
    
    _inherit='product.product'
    
    
   
    _columns={
              'subject_id':fields.many2many('info.subject','subject_book_rel','book_id','sub_id','Subject'),
              
              'authors':fields.many2many('res.partner','book_author_rel','book_id','author_id','Author'),
              'publisher_name':fields.many2one('res.partner','Publisher'),
              'date_year':fields.date('Date'),
              'purchase_date':fields.date('Purchase Date'),
              'bill_date':fields.datetime('Bill Date'),
              'book_id':fields.char('ID',readonly=True),
              'book_instance_number':fields.char('Book Instance No'),
              'days_to_lend':fields.integer('Days To Lend',required=True)


              }
    _defaults={
              # 'book_id':lambda self, cr, uid, context:self.pool.get('ir.sequence').get(cr, uid, 'test.test.code'),
 
               }
    
    
  
product_product()
    

 

class library_form(osv.osv):
    
    _name='library.form'
    
    _columns={
              'name':fields.char('ID',required=True,readonly=True,select=True,states={'draft':[('readonly', False)]}),
          
              'student_id':fields.many2one('res.partner','Student',required=True,readonly=True,select=True,states={'draft':[('readonly', False)]}),
       
              
              }
    _defaults={
               'name':lambda self,cr,uid,context:self.pool.get('ir.sequence').get(cr,uid,'library.form'),
               'state':'draft'
              # 'state':'draft'
               }
    
library_form()


   
    

 

 

 

 

 

 

 

 

0
Avatar
Discard
Odoo Support Team
Hi Here I attached my module

On Wed, Jan 14, 2015 at 12:11 PM, atchuthan <atchuthantu@mail.odoo.com> wrote:

A new answer for Security Access Rights Error For a Custom Module has been posted. Click here to access the post.

--
atchuthan
Sent by Odoo Inc. using Odoo about Forum Post Security Access Rights Error For a Custom Module



--
Thanks&Regards
Libu Koshy
Avatar
Med Said BARA
Best Answer

This can help you: http://stackoverflow.com/questions/16601836/error-occured-while-adding-security-to-a-module-in-openerp

Last, you Menu "Library Mangement" will not appear if there is no Sub-Menu under it (another menu in the view with: parent="main_library_menu_id").

1
Avatar
Discard
Avatar
Atchuthan - Technical Consultant, Sodexis Inc
Best Answer

__openerp__.py

{
    'name':'Library Management',
    'version':'7.0',
    'author':'Me',
    'website':'http://www.test.com',
    'depends':['base','sale'],
    'category':'General',
    'description':'Library management module',
    'data':[
            'security/training_security.xml',         #Add security, wizard and other data files first
            'security/ir.model.access.csv',

            'book_info_view.xml',
            #'bookid_sequence.xml',
            'student_id.xml',
            ],
    'demo':[]
}

In security.xml,
        <record model="ir.module.category" id="module_category_tools">
            <field name="name">Library mgt System</field>
            <field name="sequence">5</field>
        </record>
        <record id="group_user_lms" model="res.groups">    <!-- Group ID to be linked @ ir.model.access.csv -->
            <field name="name">User</field>
            <field name="category_id" ref="module_category_tools" />
        </record>
        <record id="group_admin_lms" model="res.groups">
            <field name="name">Admin</field>
            <field name="category_id" ref="module_category_tools" />
            <field name="implied_ids" eval="[(4, ref('group_user_lms'))]" />

            <field name="users" eval="[(4, ref('base.user_root'))]" />
        </record>

0
Avatar
Discard
ABU K
Author

Hi atchuthan ...Thanks for replay... I changed code but got this error now.. Exception: Module loading library_management_credatv failed: file library_management_credatv/security/ir.model.access.csv could not be processed: Line 1 : No matching record found for external id 'library_management_credatv.group_training_user' in field 'Group'

ABU K
Author

How to change this code i get error from view

Atchuthan - Technical Consultant, Sodexis Inc

then modify the group linked at ir.model.access.csv with your group id i.e. 'library_management_credatv.group_training_user' ---> 'library_management_credatv.group_user_lms'

ABU K
Author

I changed in csv file ,and in view.xml file is ..... is this correct

Atchuthan - Technical Consultant, Sodexis Inc

i didn't get your attachment... if possible send it via skype (username- 'atchuthan_skype')

Avatar
DAJ MI 5, Bole
Best Answer

In your security xml file.. you declared id  id="library_management_credatv.group_tool_user">
In your ir.security.access you try to assign:  library_management_credatv.group_training_user 

maybe you want to re check those ids?

2.nd edit:
also i don't see :  <field name="category_id" ref="library_management_credatv.module_category_tools"/>
category defined anywhere.. ?
 

0
Avatar
Discard
ABU K
Author

I got same error I changed the code as per your suggestion

Avatar
Farid Ghanchi
Best Answer

Hello LIBU,

First you create one categoryrelated to library, EX:

record model="ir.module.category" id="module_lms">
            <field name="name">Library mgt System</field>
            <field name="sequence">2</field>
            <field name="visible" eval="0" />
        </record>

then assign it to that id

<field name="category_id" ref="module_lms"/>

Thanks

0
Avatar
Discard
Avatar
Ivan
Best Answer

I'm assuming that you have create module category with id "library_management_credatv.module_category_tools" as @farid has indicated.

I'm also assuming that you have synchronized the group name as @Bole has suggested.

The error may occur if you use the group within view XML because you order the view XML before the group and security XML.  I would suggest that you try to put 'security/training_security.xml' as the first item in 'data' and 'security/ir.model.access.csv' as the 2nd.  Followed by others.

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now