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.

1

How to add a new action menu item?

By
sanaa tayb
on 5/15/13, 11:14 AM 12,814 views

hello everyone , i'm trying to add a new menuitem on my created module , and have no idea how to do so ... Can anyone give me any hints or any exemples ...

my module is working fine , in the menu on the left side i want to add a new link if i may say so .. pleaase help me

wanna add directly into system or from code , plz describe

Sandeep
on 5/15/13, 11:18 AM

i want to add it using code .

sanaa tayb
on 5/15/13, 11:24 AM

I would like to add a button directly from system - how can I do that? I cannot find these sections when editing FormView, thank you!

Tilfried Weissenberger
on 8/13/15, 5:45 AM
4

Anas Taji

--Anas Taji--
2203
| 6 7 8
Amman, Jordan
--Anas Taji--

Skype: anas.taji-sw

Email: anas.taji@smartway-jo.com

Anas Taji
On 5/15/13, 12:17 PM

In your view definition xml file your_module_view.xml add the following code (you may want to change some parameters into yours):

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- Your List View Definition -->
<record id="view_your_model_name_tree" model="ir.ui.view">
    <field name="name">Your.Module.Name_tree</field>
    <field name="model">your.object</field>
    <field name="arch" type="xml">
        <tree string="ANY NAME">
            <!-- Add All Fields You Want In The List Here -->
            <field name="db_field_name"/>
        </tree>
    </field>
</record>

<!-- Your Form View Definition -->
<record id="view_your_model_name_form" model="ir.ui.view">
    <field name="name">Your.Module.Name_form</field>
    <field name="model">your.object</field>
    <field name="arch" type="xml">
        <form string="Form View Name" version="7.0">
            <!-- Add All Fields You Want In The Form Here -->
            <field name="db_field_name"/>
        </form>
    </field>
</record>

<!-- Your Action Window Definition -->
<record id="action_123" model="ir.actions.act_window">
    <field name="name">Your Module Name</field>
    <field name="res_model">your.object</field>
    <field name="view_type">form</field>
    <field name="view_mode">list,form</field>
</record>

<!-- Action Menu Item Related To Above Action Window -->
<menuitem 
action="action_123" 
id="action_menu_123" 
parent="write_the_parent_menu_id"
name="Readable Text" 
sequence="1"/>
</data>
</openerp>

You may also want to take a look at idea module under your addons directory..%

it did work now i have a menu in the lest with 2 links one to list the list of my records( informations about my patient ) and second one to create a new record ( a new patient) ... Now my problem is i added a third menuitem ( so i can add an apointement for my patients ) but it didnt work .

sanaa tayb
on 5/15/13, 12:55 PM

i created a new file RDV .py , and added in my old Xml file ( the one i used in my module ) another List View Definition and Form View Definition , Action Window Definition and Action Menu Item Related To the new Action Window ... is it the right thing to do or should i create a new XML file ?? and if i shoold create a new one how to relate it to the old one ?

sanaa tayb
on 5/15/13, 1:01 PM

I am not sure if i got what you are asking for, You have one 'action menu item' that opens a list of patients (list view), and a form that shows patient per page (form view).

and you want to have another 'action menu item' to specify an appointment for a patient, am i right?

Smart Way LLC, Anas Taji
on 5/15/13, 1:36 PM

Yes that's the idea .

sanaa tayb
on 5/15/13, 4:43 PM

ok, ask it in another question instead of extending the current one..%

Smart Way LLC, Anas Taji
on 5/15/13, 5:55 PM

Ok i did it :), thank you for all your answers

sanaa tayb
on 5/15/13, 6:29 PM
0

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 5/15/13, 11:30 AM

Hi sey

Look below example :

<menuitem name="Example" action="define_your_menu_action" id="define_your_id" parent="parent_menu_id"/>

In menuitem name tag give your menu name and in action tag define your view action and in id tag define menu_id and parent tag give parent menu id means give id in which model menu you want to display your new menu.

Thank You

thank you very muuuch :)

sanaa tayb
on 5/15/13, 12:42 PM
0
Shelton
On 5/15/13, 11:27 AM
<menuitem id="my_menu_id" name="My Menu"
        parent="parent_menu_id" sequence="1"/>

thank you very much it did work , now to add an action to this new menuitem , i create a new form, new tree and stuff like the first one ??

sanaa tayb
on 5/15/13, 11:51 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

2 follower(s)

Stats

Asked: 5/15/13, 11:14 AM
Seen: 12814 times
Last updated: 2/11/16, 3:06 AM