This question has been flagged
2 Replies
9357 Views

Hi,

I am new to openERP and using v-7. I have created couple of modules.

I want to create a module to Hide or Disable Modules menu (and its sub-menu) from the left side.

Right now, this is showing in the Modules menu:

  • Modules
    • Installed Modules
    • Updates
    • Update Modules List
    • Apply Scheduled Upgrades
    • Apps

In /openerp/addons/web/static/src/xml/base.xml this is defined

<t t-name="Menu.secondary">
<div t-foreach="widget.data.data.children" t-as="menu" style="display: none" class="oe_secondary_menu" t-att-data-menu-parent="menu.id">
    <t t-foreach="menu.children" t-as="menu">
        <div class="oe_secondary_menu_section">
            <t t-esc="menu.name"/>
            <!--
                Shall the section be still clickable ?
                <t t-call="Menu.link"/>
            -->
        </div>
        <t t-call="Menu.secondary.submenu"/>
    </t>
</div>

</t>

How do I suppose to extend this in my module or is there any other way of doing this?

Avatar
Discard
Best Answer

Hi;

You should take a look at the code HERE

My advice is, to never modify an existing module belonging to the core of OpenERP (openerp- server or openerp-addons) !!!

What you can do is, to create a new module (if possible) or at least to make your changes on an extra-module.

HERE you can find an example on how to make some changes on a module. (I've made those changes in order to fix a Bug, but the example is still valide in your case).

Fortunately, this example correspond exactly to your need.

You have to read the code carrefully, and try to understand how the actions are performed, and then make your own changes ... repeat ... and repeat ... again... and again ...

Make your changes only on the modules oerp_no_phoning_home and the web_hideleftmenu, don't modify the files in ..../openerp/addons/web/....

Link to oerp_no_phoning_home.

oerp_no_phoning_home and web_hideleftmenu are a good "place" where you can start learning how to achieve this task ...

If you succeed, then you can create your own module, Which can hide a part, or some parts of the menu, as you wish ...

good luck.

Avatar
Discard
Best Answer

A menu is a standard document (database record) in OpenERP.

Create a new group called 'Nobody'.

Assign the menu to this group.

You can do this in a module by simply using XML to create the group and modify the groups of the menu.

<record id="<the XML ID of your new group>" model="res.groups">
    <field name="name">Nobody</field>
</record>

<record id="base.menu_management" model="ir.ui.menu">
    <!-- Use the `ref()` method to resolve the group XML ID -->
    <field name="groups_id" eval="[ref(<the XML ID of your new group>)]"/>
</record>

(Note the XML is from memory, so there could be minor typo's)

Avatar
Discard