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

Custome module is not showing to users XML,CSV access rights issue

By
ravikuamr
on 2/7/14, 3:13 AM 1,113 views

Hello Openerp Develpoers. I have created a custom module today, Its working fine when accesing from admin., But module menu is not appearing on top menu bar when accessing from non admin users. I created the access rights in security folder, I think I did some thing wrong in security xml and csv files, can somebody help me get out of this problem.

I listed my module files and code below. Check it Let me What I did wrong or What I missed out.

forum_view.xml, forum.py, __init__.py, __openerp__.py security/forum_nyros_security.xml security/ir.model.access.csv

__init__.py

 import forum

__openerp__.py

 {    
'name' : "Nyros Discussion Forum",  
'category' : "Test", 
'version' : "1.0", 
'depends' : ['base','mail'],
'author' : "Me",
'description' : """\
 module for managing trainings:
  - training courses
   - training sessions
 - attendees registration""", 
'data' : ['forum_view.xml',
'security/forum_nyros_security.xml',
'security/ir.model.access.csv']
}

forum.py

import datetime
import time
import openerp
from openerp.osv import osv, fields

class Course(osv.osv):
_name = "forum.course"
_inherit = ['mail.thread', 'ir.needaction_mixin']
_columns = {
          'name' : fields.char(string="Question Title", size=256, required=True),
          'description' : fields.text(string="Question Description", required=True),
          'date_of_q_created': fields.datetime('Date of Created'),
          'category_question': fields.many2one('forum.categ', 'Question Category'),
          'create_uid': fields.many2one('res.users', 'Question Created By', readonly=True),
             }

 Course()
 class question_categ(osv.osv):
_name='forum.categ'
_description='category of Question'
_columns={
   'name':fields.char('Create a Category type',size=100)
}
question_categ()

forum_view.xml

<openerp>
    <data>

    <!--  search view -->

    <record id="forum_search" model="ir.ui.view">
        <field name="name">forum.search</field>
        <field name="model">forum.course</field>
        <field name="type">search</field>
        <field name="arch" type="xml">
            <search string="Question Answer Discussion Forum">
                   <field name="name"/>
                   <field name="description"/>
                   <field name="date_of_q_created"/>
            </search>
        </field>
    </record>

    <!--  Tree View -->

    <record model="ir.ui.view" id="course_tree_view">
        <field name="name">forum.course.tree</field>
        <field name="model">forum.course</field>
        <field name="arch" type="xml">
            <tree string="Questions">
                <field name="name"/>
               <!-- <field name="description"/>-->
                <field name="date_of_q_created" />
                <field name="category_question"/>
                <field name="create_uid"/>
            </tree>
        </field>
    </record>

    <!--  Form View -->

    <record model="ir.ui.view" id="course_form_view">
        <field name="name">forum.course.form</field>
        <field name="model">forum.course</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Question and Answer" version = "v7">
                <sheet>
                <group string="Question">
                <field name="name"/>
                <field name="description"/>
                <field name="date_of_q_created" />
                <field name="category_question"/>
                <field name="create_uid"/>
                </group>
                <group string="Answers and Comments">
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
                </group>
                </sheet>
            </form>
        </field>
    </record>

    <!--  Action View -->


<record model="ir.actions.act_window" id="course_list_action">
    <field name="name">Questions form</field>
    <field name="res_model">forum.course</field>
            <field name="target">current</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
</record>

    <!-- Menu Items -->

    <menuitem id="main_forum_menu" name="Manage forum" />
    <menuitem id="forum_menu" name="Discussion Forum" parent="main_forum_menu" />
    <menuitem id="courses_menu" name="Questions sidemenu" parent="forum_menu" action="course_list_action" />


    </data>
</openerp>

security/forum_nyros_security.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="group_forum_manager" model="res.groups">
        <field name="name">Forum Management/ Manager</field>
    </record>
    <record id="group_forum_user" model="res.groups">
        <field name="name">Forum Management / User</field>
    </record>
</data>
</openerp>

security/ir.model.access.csv

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_forum_course,forum.course,model_forum_course,forum_nyros.group_forum_user,1,1,1,1
access_forum_categ,forum.categ,model_forum_categ,forum_nyros.group_forum_user,1,1,1,1

Give the right's of 'Forum Management / User' to other users. You can find it at Access Rights section of that user.

Hiral Patel (hip)
on 2/7/14, 9:11 AM

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

0 follower(s)

Stats

Asked: 2/7/14, 3:13 AM
Seen: 1113 times
Last updated: 3/16/15, 8:10 AM