You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

  1. odoo.define('menu_technical_info.Menu', function (require) {
  2. "use strict";
  3. var $ = require('$'),
  4. Menu = require('web.Menu'),
  5. Model = require('web.Model');
  6. Menu.include({
  7. start: function() {
  8. var self = this;
  9. var res = this._super.apply(this, arguments);
  10. this.debug = ($.deparam($.param.querystring()).debug !== undefined);
  11. this.$secondary_menus.find('[data-menu]').hover(function() {
  12. self.load_xml_id(this);
  13. });
  14. this.$el.find('a[data-menu]').hover(function() {
  15. self.load_xml_id(this);
  16. });
  17. return res;
  18. },
  19. load_xml_id: function(menu_item) {
  20. if(!this.debug) return;
  21. var $menu_item = $(menu_item);
  22. if($menu_item.is('[title]')) return;
  23. var ir_model_data = new Model('ir.model.data');
  24. var id = $menu_item.data('menu');
  25. ir_model_data.query(['module', 'name']).filter([['res_id', '=', id],['model', '=', 'ir.ui.menu']]).first().then(function(menu) {
  26. $menu_item.tooltip({
  27. title: menu.module + '.' + menu.name
  28. }).tooltip('show');
  29. });
  30. }
  31. });
  32. });