Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Security Access Rights Error For a Custom Module [Closed]

By
Odoo
on 1/14/15, 5:30 AM 420 views

The Question has been closed for reason: duplicate question

by
Odoo
on 01/15/2015 06:23:06

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()


   

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/14/15, 5:30 AM
Seen: 420 times
Last updated: 3/16/15, 8:10 AM