我只想自定义会计模块,所以我想从那里采用一些菜单。那么如何找到该特定菜单项的动作ID呢? 什么是最简单的方法?
答案 0 :(得分:0)
这是菜单ID获取的示例代码:
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
答案 1 :(得分:0)
这里必需的存储在 params
中作为 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