跳至内容
菜单
此问题已终结
8 回复
17561 查看

For example i the 'Customers' menu under Sales category.

i want to change the parent of customers to my custom module's menu item name

Details

*******

sale

 -->

    sales

      ->

             customers

             My piipeline

             etc

i want to change like this

MyMain Menu

-->

     MySubMenu

     ->

             Customers

Notes

I want to add customers under Mysubmenu . Please help me how to get the answer.Thanks in advance

形象
丢弃
编写者

thanks IT Libertas

编写者

Thanks Mahmoud

编写者

Thanks Ajmal

最佳答案

You can inherit the customer menu in your module and change it parent to your new submenue,

such as:

<menuitem name="Menu name"

            id="module.menu_id"

            parent="your_sub_menu" />

 

Example :

<menuitem name="Customers"

            id="base.menu_base_partner"

            parent="MySubMenu"

        />

形象
丢弃
最佳答案

You can change any xml view by naming id to model_name.id:

here you need to change it as:

<menuitem id="sales_team.menu_partner_form" parent="your_parent_menu_id" action="base.action_partner_form" sequence="3"/>

You can also achieve the same if you create a new menu item and give the action base.action_partner_form and hide the current customers if needed.

形象
丢弃
最佳答案

You may do on interface or code level:

If code, you should fully redefine the meny unit xml in your app. E.g. for a pipeline in crm,   

<menuitem   id="crm.menu_crm_opportunities" action="crm.action_your_pipeline" parent="NEW_PAPRENT" sequence="4"/>

If on interface: go to Settings > Technical > User Interface > Menu Items > Find required and change the field 'Parent Menu' to yours. Be cautious: if you update the original app (e.g. Crm for a pipeline), parent would be changed back. Thus, it is better to use script modifications.

形象
丢弃
最佳答案

You can change any xml view by naming id to model_name.id:

here you need to change it as:

<menuitem id="sales_team.menu_partner_form" parent="your_parent_menu_id" action="base.action_partner_form" sequence="3"/>

You can also achieve the same if you create a new menu item and give the action base.action_partner_form and hide the current customers if needed.

形象
丢弃
最佳答案

Actuallly the best way to do this is by replacing the parent of the original view by your new id.

Example: Open a folder --> create a file.xml, __manifest__.py, __ini__.py

In your file.xml add the following

<?xml version="1.0" encoding="UTF-8"?>

<odoo>

    <data>

        <!--<record id ="property_sales_menu" model ="ir.ui.view">  -->

            <menuitem id="property_sales_menu_root"                 action="sales_team.crm_team_salesteams_act" sequence="5" name="Property Sales"/>

              <menuitem id="property_sales_menu_sub" parent ="property_sales_menu_root" sequence="1" name="Property Sales"/>

形象
丢弃
相关帖文 回复 查看 活动
1
6月 19
9251
2
3月 18
10783
2
7月 25
4510
2
12月 24
7680
2
11月 24
28442