[IMP] needaction counters: moved rpc call on the trigger menu_loaded, to be able to reload the needaction counters through this trigger.

bzr revid: tde@openerp.com-20121129164253-j2vol27w0libpdsd
This commit is contained in:
Thibault Delavallée 2012-11-29 17:42:53 +01:00
parent 0de15c9bbf
commit a5ca416f05
1 changed files with 8 additions and 4 deletions

View File

@ -799,10 +799,18 @@ instance.web.client_actions.add("change_password", "instance.web.ChangePassword"
instance.web.Menu = instance.web.Widget.extend({
template: 'Menu',
init: function() {
var self = this;
this._super.apply(this, arguments);
this.has_been_loaded = $.Deferred();
this.maximum_visible_links = 'auto'; // # of menu to show. 0 = do not crop, 'auto' = algo
this.data = {data:{children:[]}};
this.on("menu_loaded", this, function (e) {
// launch the fetch of needaction counters, asynchronous
this.rpc("/web/menu/load_needaction", {menu_ids: false}).done(function(r) {
self.on_needaction_loaded(r);
});
});
},
start: function() {
this._super.apply(this, arguments);
@ -835,10 +843,6 @@ instance.web.Menu = instance.web.Widget.extend({
}
this.trigger('menu_loaded', data);
this.has_been_loaded.resolve();
// Now launch the fetch of needaction counters, asynchronous
this.rpc("web/menu/load_needaction", {menu_ids: false}).done(function(r) {
self.on_needaction_loaded(r);
});
},
on_needaction_loaded: function(data) {
var self = this;