pythonxmlodooopenerp-7

How to find action ids of menu items in odoo?


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?


Solution

  • 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')