Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6246 Lượt xem

Edit: Answered! Thanks!

Accomplish:
I want to combine point of sale and inventory menu items into 1 custom module titled "storefront". Then disable the pos and inventory modules from the menu.

Example: 
OpenHRMS 12.0 does this perfectly. They combined all HR modules into 1 module and the menu items of the regular modules are removed from the main menu. Its beautiful.

What i have - errors out when upgrading custom module - this should lead to the main pos dashboard:

<menuitem name="Dashboard" id="action_pos_dash_menu" parent="storefront_root_menu"

              sequence="1" action="point_of_sale.menu_pos_dashboard" groups="base.group_user"/>


How i got this:
I just used the standard method of creating a menuitem however i went to settings > menu items > pos dashboard > view meta data to see get "point_of_sale.menu_pos_dashboard"

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

If you are looking to replace some existing menus to some other position, like suppose if you want to change the POS Dashboard menu as submenu of the new menu you have created, you can do it like this,

<menuitem id="point_of_sale.menu_pos_dashboard"
action="action_pos_config_kanban"
parent="storefront_root_menu"
name="Dashboard"
sequence="1"/>


Where the ID is the id of the original Dashboard menu in POS, this will make the Dashboard menu under your new menu and will remove the original one from the Point of sale menu.

EIther you can use this way, or you can add a new menu rather than rewriting the existing menu and then you can hide the original menu by adding some groups to menu in which no users are there.


Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

EDIT: I figured it out! Thanks so much! You guys are awesome :)

Hey, Cybrosys, thank you so much for the reply! And thank you for OpenHrms, you guys are amazing! <3 

I'd send this as a comment but i need 1 more karma point to do so. 

Follow up question: So ID = XML ID in metadata. Where do you get the action? Your example has "action_pos_config_kanban". Where can i find that for all other menu items? 

Thanks again! Really! :)

Ảnh đại diện
Huỷ bỏ

If you activate the developer mode and navigate to settings -> technical -> User interface -> menu items, you can see all the menu there, open the menu and from the lady debugger button you can get the id of the menu from the meta data. From the menu form, you can see its sub menus as well as the action of the form

Tác giả

Okay, final follow up question. I was able to get my module to upgrade and your recommendation works! I figured out how to find the action too! Thanks! However, how can i have 2 menu items leading to the same place? In my example before i had a module called "storefront". Now lets say i have another module called "Distribution". Both storefront and distribution will need the inventory module. Can i do that with this method or will one override the other?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 19
5867
0
thg 3 19
3349
0
thg 5 25
166
1
thg 5 25
364
1
thg 5 25
426