콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
17 답글
105039 화면

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

작성자

i want to add it using code .

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!

베스트 답변
<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 ??

베스트 답변

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 .

작성자

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 ?

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?

작성자

Yes that's the idea .

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

작성자

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

베스트 답변

The openERP  structure is __open__.py,__init__.py and module_name.xml.

__open__.py file contains the subsequent file data we have

__init__.py file contains the subsequent py files imports

module_name.xml having all menu items, so you should open this file and add your menu item which ever place you want

        <menuitem name="Employee" id="employee_menu_root"  />
        <menuitem name="Employee profile" id="employee_profile" parent="employee_menu_root" />
        <menuitem name="profile" id="candidate_profile" parent="employee_profile"" />

아바타
취소
베스트 답변

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 :)

관련 게시물 답글 화면 활동
1
3월 15
4309
3
1월 24
15090
17
4월 23
69102
0
12월 24
1159
4
1월 23
13300