-1

I just want to customize Accounting module so I wanna adopt some menus from there. So how can I find action ids for that particular menu item? what is the easiest way?

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Chandu
  • 2,053
  • 3
  • 25
  • 39
  • Please be more clear with your stuff so I can help you better. Which menu action you want and why you need it ? you need external id of menu item to set parent menu ? – Emipro Technologies Pvt. Ltd. Oct 30 '15 at 13:39
  • Please do follow the below link, i posted a new question .. Please help me out http://stackoverflow.com/questions/33448098/customizing-accounting-and-finance-module-in-odoo – Chandu Oct 31 '15 at 04:40

2 Answers2

1

This is Example Code for menu id get:

self.menu_xml_id = 'base.menu_action_res_users'

module_name, menu_xml_id = self.menu_xml_id.split('.')

dummy, menu_id = self.registry('ir.model.data').get_object_reference(self.cr, self.uid, module_name, menu_xml_id)

ir_ui_menu = self.registry('ir.ui.menu').browse(self.cr, self.uid, menu_id, context=None)

print "action_id==============", ir_ui_menu.action

Odoo 11, 12, 13, 14

menu = self.env.ref('base.menu_action_res_users')

Jainik Patel
  • 2,284
  • 1
  • 15
  • 35
  • Should i put this code into parent logic file or what?? – Chandu Oct 30 '15 at 13:18
  • This is the logic of find action ids if you required then put it but that is hard code for accounting module in parent view if you customize then put this code in your customize code. – Jainik Patel Oct 30 '15 at 13:21
  • bro, i have created one module like accounting but only i created menus but didn't give any parent action ids.. thats why i am not getting your answer i hope it will work but how can i made it beneficial?? for me – Chandu Oct 30 '15 at 13:24
  • This seems to be outdated. Does anyone have a working solution for Odoo 12? – Vl4dimyr Mar 24 '20 at 13:28
  • `menu = self.env.ref('base.menu_action_res_users')` works for me. – Vl4dimyr Mar 24 '20 at 13:44
  • Works, thanks. With ```self.env.ref('base.menu_action_res_users').id``` you can get the id – Plaoo Dec 14 '20 at 16:11
0

Here required are stored in params as dict

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
    # {'action': 88, 'cids': 1, 'id': 38, 'menu_id': 69, 'model': 'hospital.appointment', 'view_type': 'form'}
    res = super(hospital_appointment, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar,submenu=submenu)
    params = self._context.get('params')
    print('\n\n\n',params)

    return res
Josef
  • 2,869
  • 2
  • 22
  • 23