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.

3

custom module menus are hidden to all users other than admin

By
Emad Shaaban Amin
on 9/27/13, 12:08 PM 6,984 views

I'm learning OpenERP development and I'm stuck in a problem related to security and menu access rights, I've developed a very basic module which has just one test class and one test menu with a submenu and tree,form views .

The problem is when I log in using any user other than admin I can't access this module (I can't see the Test menu), although it's accessible to the admin user (and only to him)

Note that I didn't add any access rights or access rules (AFAIK from the documentation it should be global and accessible to all users !! )

Here is my module :

__init__.py

import testmod

.

__openerp__.py

{
'name': "Test Module",
'description': "Basic example of a (future) web module",
'category': 'Hidden',
'depends': ['base'],
'data': [
    'test_view.xml',
],
'installable': True,
'application': False,
'auto_install': False,
}

.

testmod.py

from openerp.osv import fields, osv

class testmod_test(osv.Model):

    _name = 'testmod.test'
    _description = 'Test Model'
    _columns = {
    'test1': fields.char('Test 1', size=32, required=True, help='Test 1 help'),
    'test2': fields.float('Test 2', help='Test 2 help'),
    }

testmod_test()

.

test_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record id="testmod_test_form" model="ir.ui.view">
    <field name="name">testmod.test.form</field>
    <field name="model">testmod.test</field>
    <field name="arch" type="xml">
      <form string="Test" version="7.0">  
        <field name="test1" />
        <field name="test2"/>

      </form>
    </field>
</record>

<record id="testmod_test_tree" model="ir.ui.view">
  <field name="name">testmod.test.tree</field>
  <field name="model">testmod.test</field>
  <field name="arch" type="xml">
    <tree string="Test">
      <field name="test1" />
       <field name="test2"/>
    </tree>
  </field>
</record>



<record model="ir.actions.act_window" id="action_testmod_test">
  <field name="name">Test</field>
  <field name="res_model">testmod.test</field>
  <field name="view_type">form</field>
  <field name="view_mode">tree,form</field>

</record>


<menuitem 
          name="Test" 
          id="menu_testmod_test" 

          />

<menuitem 
          name="Test sub" 
          parent="menu_testmod_test"
          id="menu_testmod_test_sub" 

          />          
<menuitem
        name="Sub Test"
        id="menu_subtest"
        parent="menu_testmod_test_sub"
        action="action_testmod_test"    
        />


</data>
</openerp>

and I'm using OpenERP 7.0 in a linux platform (ubuntu 13.04)

Any help will be appreciated :), Thanks in advance

4

AJ Schrafel Paper Corp

--AJ Schrafel Paper Corp--
2050
| 4 5 8
Bronx, United States
--AJ Schrafel Paper Corp--

Exploring OpenERP for business

AJ Schrafel Paper Corp
On 9/27/13, 12:16 PM

the default access rights restrict to ONLY the admin, that is how good security works.

You must add access rights, it is better to create groups with access rights then add users to those groups but if you want a fast and direct globally available module here you go:

ir.model.access.csv

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_testmod_test,access_testmod_test,model_testmod_test,,1,1,1,1

Make sure to import the the access file in your __openerp__.py file.

'data': [
   # your other files
    'security/ir.model.access.csv',
],

Thanks a million patently, you've saved me :) Seems that i've interpreted this sentence the wrong way "A menu that is not granted to any group is accessible to every user." Thanks again :)

Emad Shaaban Amin
on 9/27/13, 12:28 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 9/27/13, 12:08 PM
Seen: 6984 times
Last updated: 9/21/16, 8:00 AM