[go: up one dir, main page]

0% found this document useful (0 votes)
78 views3 pages

Odoo 1

This document outlines the steps to create a module that adds a sub menu to the main menu in Odoo. These steps include creating a new module, defining the module in manifest.py, creating an XML file to define the sub menu, installing the module.

Uploaded by

mutaurwaannette
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views3 pages

Odoo 1

This document outlines the steps to create a module that adds a sub menu to the main menu in Odoo. These steps include creating a new module, defining the module in manifest.py, creating an XML file to define the sub menu, installing the module.

Uploaded by

mutaurwaannette
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

To create a module that adds a sub menu on the main menu in Odoo, follow these steps:

1. Create a new module by running the following command in your Odoo development environment:

```

odoo-bin scaffold my_module /path/to/addon_directory

```

2. Open the `__manifest__.py` file in your module directory and add the following code to define your
module:

```python

'name': 'My Module',

'version': '1.0',

'summary': 'Add sub menu to main menu',

'description': """

This module adds a sub menu to the main menu in Odoo.

""",

'category': 'Tools',

'depends': ['base'],

'data': [

'views/my_menu.xml',

],

'installable': True,

}
```

3. Create a new file called `my_menu.xml` in your module's `views` directory and add the following code
to define your sub menu:

```xml

<odoo>

<data>

<menuitem id="menu_my_module" name="My Module" sequence="10"/>

<menuitem id="menu_my_sub_menu" name="My Sub Menu" parent="menu_my_module"


action="my_module.action_my_sub_menu"/>

<record id="action_my_sub_menu" model="ir.actions.act_window">

<field name="name">My Sub Menu</field>

<field name="res_model">my_module.my_model</field>

<field name="view_mode">tree,form</field>

</record>

</data>

</odoo>

```

4. In this example, we have created a sub-menu called "My Sub Menu" under the main menu "My
Module". We have also defined an action for the sub-menu that will open a tree and form view of a
model called `my_module.my_model`.

5. Finally, install your module by restarting Odoo and going to the Apps menu. Find your module and
click the "Install" button.
6. Once installed, you should see your new sub-menu in the main menu of Odoo. Clicking on it should
open the view defined in the `my_menu.xml` file.

Daily quota: 8/10

ENG | ES | ‫ | عربي‬中文 | ‫فارسی‬

You might also like