diff options
| author | Jérome Maes <jem@openerp.com> | 2016-12-05 11:27:02 +0100 |
|---|---|---|
| committer | Jérome Maes <jem@openerp.com> | 2016-12-05 11:30:03 +0100 |
| commit | 13f84b9aca163a8d295678f234ddc0f5b9407111 (patch) | |
| tree | 5004f039409db4965f6ca7d96c9c1cdc55cc5ea7 /addons/web/static/src/js/menu.js | |
| parent | d25c8e7aa5d610db5d13f7dd041b25a4220d84dc (diff) | |
[REM] *: remove ir.needaction mixin
ir.needaction_mixin is not used anymore by the webclient.
From 9.0, the concept has changed: this feature is now
available in mail module, with the mail.thread mixin,
and message_neeadction field.
Remove all code handeling needaction bullet and
counter on ir.ui.menu, knowing that since 9.0
webclient does not display the counter anymore.
This code was, thus, useless and some RPC calls
were done for nothing, and adapt accounting
reconcialiation widget.
Diffstat (limited to 'addons/web/static/src/js/menu.js')
| -rw-r--r-- | addons/web/static/src/js/menu.js | 65 |
1 files changed, 7 insertions, 58 deletions
diff --git a/addons/web/static/src/js/menu.js b/addons/web/static/src/js/menu.js index 8eb1552cea4..5fdfec5fb37 100644 --- a/addons/web/static/src/js/menu.js +++ b/addons/web/static/src/js/menu.js @@ -13,15 +13,6 @@ var Menu = Widget.extend({ this._super.apply(this, arguments); this.is_bound = $.Deferred(); this.data = {data:{children:[]}}; - this.on("menu_bound", this, function() { - // launch the fetch of needaction counters, asynchronous - var $all_menus = self.$el.parents('.o_web_client').find('.o_sub_menu').find('[data-menu]'); - var all_menu_ids = _.map($all_menus, function (menu) {return parseInt($(menu).attr('data-menu'), 10);}); - if (!_.isEmpty(all_menu_ids)) { - this.do_load_needaction(all_menu_ids); - } - }); - core.bus.on('do_reload_needaction', this, this.do_reload_needaction); core.bus.on('change_menu_section', this, this.on_change_top_menu); }, start: function() { @@ -39,8 +30,7 @@ var Menu = Widget.extend({ this.$el.on('click', 'a[data-menu]', function (event) { event.preventDefault(); var menu_id = $(event.currentTarget).data('menu'); - var needaction = $(event.target).is('div#menu_counter'); - core.bus.trigger('change_menu_section', menu_id, needaction); + core.bus.trigger('change_menu_section', menu_id); }); // Hide second level submenus @@ -62,27 +52,7 @@ var Menu = Widget.extend({ this.is_bound.resolve(); }, - do_load_needaction: function (menu_ids) { - var self = this; - menu_ids = _.compact(menu_ids); - if (_.isEmpty(menu_ids)) { - return $.when(); - } - return this.rpc("/web/menu/load_needaction", {'menu_ids': menu_ids}).done(function(r) { - self.on_needaction_loaded(r); - }); - }, - on_needaction_loaded: function(data) { - var self = this; - this.needaction_data = data; - _.each(this.needaction_data, function (item, menu_id) { - var $item = self.$secondary_menus.find('a[data-menu="' + menu_id + '"]'); - $item.find('.badge').remove(); - if (item.needaction_counter && item.needaction_counter > 0) { - $item.append(QWeb.render("Menu.needaction_counter", { widget : item })); - } - }); - }, + /** * Reflow the menu items and dock overflowing items into a "More" menu item. * Automatically called when 'menu_bound' event is triggered and on window resizing. @@ -193,9 +163,8 @@ var Menu = Widget.extend({ * Process a click on a menu item * * @param {Number} id the menu_id - * @param {Boolean} [needaction=false] whether the triggered action should execute in a `needs action` context */ - menu_click: function(id, needaction) { + menu_click: function(id) { if (!id) { return; } // find back the menuitem in dom to get the action @@ -218,7 +187,6 @@ var Menu = Widget.extend({ if (action_id) { this.trigger('menu_click', { action_id: action_id, - needaction: needaction, id: id, previous_menu_id: this.current_menu // Here we don't know if action will fail (in which case we have to revert menu) }, $item); @@ -227,38 +195,19 @@ var Menu = Widget.extend({ } this.open_menu(id); }, - do_reload_needaction: function () { - var self = this; - if (self.current_menu) { - self.do_load_needaction([self.current_menu]).then(function () { - self.trigger("need_action_reloaded"); - }); - } - }, + /** * Change the current top menu * * @param {int} [menu_id] the top menu id - * @param {boolean} [needaction] true to redirect to menu's needactions */ - on_change_top_menu: function(menu_id, needaction) { + on_change_top_menu: function(menu_id) { var self = this; - // Fetch the menu leaves ids in order to check if they need a 'needaction' - var $secondary_menu = this.$el.parents().find('.oe_secondary_menu[data-menu-parent=' + menu_id + ']'); - var $menu_leaves = $secondary_menu.children().find('.oe_menu_leaf'); - var menu_ids = _.map($menu_leaves, function (leave) {return parseInt($(leave).attr('data-menu'), 10);}); - - self.do_load_needaction(menu_ids).then(function () { - self.trigger("need_action_reloaded"); - }); - this.$el.parents().find(".oe_secondary_menus_container").scrollTop(0,0); - - this.menu_click(menu_id, needaction); + this.menu_click(menu_id); }, on_menu_click: function(ev) { ev.preventDefault(); - var needaction = $(ev.target).is('div#menu_counter'); - this.menu_click($(ev.currentTarget).data('menu'), needaction); + this.menu_click($(ev.currentTarget).data('menu')); }, }); |
