[FIX] Merge fix in saas1 for the problem that made the server crash when install a db
bzr revid: nicolas.vanhoren@openerp.com-20130610144915-0nj8vpk7n84ocj3f bzr revid: nicolas.vanhoren@openerp.com-20130610150657-3xddn91gm0iq0ubp bzr revid: nicolas.vanhoren@openerp.com-20130610154514-oee6s4f9g17bx63z
This commit is contained in:
@@ -913,9 +913,7 @@ instance.web.Menu = instance.web.Widget.extend({
|
||||
self.reflow();
|
||||
// launch the fetch of needaction counters, asynchronous
|
||||
if (!_.isEmpty(menu_data.all_menu_ids)) {
|
||||
this.rpc("/web/menu/load_needaction", {menu_ids: menu_data.all_menu_ids}).done(function(r) {
|
||||
self.on_needaction_loaded(r);
|
||||
});
|
||||
this.do_load_needaction(menu_data.all_menu_ids);
|
||||
}
|
||||
});
|
||||
var lazyreflow = _.debounce(this.reflow.bind(this), 200);
|
||||
@@ -941,7 +939,7 @@ instance.web.Menu = instance.web.Widget.extend({
|
||||
this.data = {data: data};
|
||||
this.renderElement();
|
||||
this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this }));
|
||||
this.$el.on('click', 'a[data-menu]', this.on_menu_click);
|
||||
this.$el.on('click', 'a[data-menu]', this.on_top_menu_click);
|
||||
// Hide second level submenus
|
||||
this.$secondary_menus.find('.oe_menu_toggler').siblings('.oe_secondary_submenu').hide();
|
||||
if (self.current_menu) {
|
||||
@@ -950,6 +948,16 @@ instance.web.Menu = instance.web.Widget.extend({
|
||||
this.trigger('menu_loaded', data);
|
||||
this.has_been_loaded.resolve();
|
||||
},
|
||||
do_load_needaction: function (menu_ids) {
|
||||
var self = this;
|
||||
menu_ids = _.reject(menu_ids, _.isEmpty);
|
||||
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;
|
||||
@@ -1081,11 +1089,38 @@ instance.web.Menu = instance.web.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");
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Jquery event handler for menu click
|
||||
*
|
||||
* @param {Event} ev the jquery event
|
||||
*/
|
||||
on_top_menu_click: function(ev) {
|
||||
var self = this;
|
||||
var id = $(ev.currentTarget).data('menu');
|
||||
var menu_ids = [id];
|
||||
var menu = _.filter(this.data.data.children, function (menu) {return menu.id == id;})[0];
|
||||
function add_menu_ids (menu) {
|
||||
if (menu.children) {
|
||||
_.each(menu.children, function (menu) {
|
||||
menu_ids.push(menu.id);
|
||||
add_menu_ids(menu);
|
||||
});
|
||||
}
|
||||
};
|
||||
add_menu_ids(menu);
|
||||
self.do_load_needaction(menu_ids).then(function () {
|
||||
self.trigger("need_action_reloaded");
|
||||
});
|
||||
this.on_menu_click(ev);
|
||||
},
|
||||
on_menu_click: function(ev) {
|
||||
ev.preventDefault();
|
||||
var needaction = $(ev.target).is('div.oe_menu_counter');
|
||||
|
||||
@@ -1144,7 +1144,8 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, {
|
||||
}
|
||||
qs = '?' + $.param(params);
|
||||
}
|
||||
return this.prefix + path + qs;
|
||||
var prefix = _.any(['http://', 'https://', '//'], _.bind(_.str.startsWith, null, path)) ? '' : this.prefix;
|
||||
return prefix + path + qs;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||
init: function(parent, dataset, view_id, options) {
|
||||
var self = this;
|
||||
this._super(parent);
|
||||
this.ViewManager = parent;
|
||||
this.set_default_options(options);
|
||||
this.dataset = dataset;
|
||||
this.model = dataset.model;
|
||||
@@ -720,6 +721,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||
return this.save().done(function(result) {
|
||||
self.trigger("save", result);
|
||||
self.to_view_mode();
|
||||
}).then(function(result) {
|
||||
self.ViewManager.ActionManager.__parentedParent.menu.do_reload_needaction();
|
||||
});
|
||||
},
|
||||
on_button_cancel: function(event) {
|
||||
@@ -2901,7 +2904,7 @@ instance.web.form.FieldRadio = instance.web.form.AbstractField.extend(instance.w
|
||||
var domain = instance.web.pyeval.eval('domain', this.build_domain()) || [];
|
||||
if (! _.isEqual(self.domain, domain)) {
|
||||
self.domain = domain;
|
||||
var ds = new instance.web.DataSet(self, self.field.relation);
|
||||
var ds = new instance.web.DataSetStatic(self, self.field.relation, self.build_context());
|
||||
ds.call('search', [self.domain])
|
||||
.then(function (records) {
|
||||
ds.name_get(records).then(function (records) {
|
||||
@@ -3151,6 +3154,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||
instance.web.form.CompletionFieldMixin.init.call(this);
|
||||
this.set({'value': false});
|
||||
this.display_value = {};
|
||||
this.display_value_backup = {};
|
||||
this.last_search = [];
|
||||
this.floating = false;
|
||||
this.current_display = null;
|
||||
@@ -3234,6 +3238,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||
);
|
||||
pop.on('write_completed', self, function(){
|
||||
self.display_value = {};
|
||||
self.display_value_backup = {};
|
||||
self.render_value();
|
||||
self.focus();
|
||||
});
|
||||
@@ -3284,6 +3289,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||
if (self.last_search.length > 0) {
|
||||
if (self.last_search[0][0] != self.get("value")) {
|
||||
self.display_value = {};
|
||||
self.display_value_backup = {};
|
||||
self.display_value["" + self.last_search[0][0]] = self.last_search[0][1];
|
||||
self.reinit_value(self.last_search[0][0]);
|
||||
} else {
|
||||
@@ -3349,6 +3355,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||
var item = ui.item;
|
||||
if (item.id) {
|
||||
self.display_value = {};
|
||||
self.display_value_backup = {};
|
||||
self.display_value["" + item.id] = item.name;
|
||||
self.reinit_value(item.id);
|
||||
} else if (item.action) {
|
||||
@@ -3394,6 +3401,11 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||
this.alive(dataset.name_get([self.get("value")])).done(function(data) {
|
||||
self.display_value["" + self.get("value")] = data[0][1];
|
||||
self.render_value(true);
|
||||
}).fail( function (data, event) {
|
||||
// avoid displaying crash errors as many2One should be name_get compliant
|
||||
event.preventDefault();
|
||||
self.display_value["" + self.get("value")] = self.display_value_backup["" + self.get("value")];
|
||||
self.render_value(true);
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -3437,9 +3449,13 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||
var self = this;
|
||||
if (value_ instanceof Array) {
|
||||
this.display_value = {};
|
||||
this.display_value_backup = {}
|
||||
if (! this.options.always_reload) {
|
||||
this.display_value["" + value_[0]] = value_[1];
|
||||
}
|
||||
else {
|
||||
this.display_value_backup["" + value_[0]] = value_[1];
|
||||
}
|
||||
value_ = value_[0];
|
||||
}
|
||||
value_ = value_ || false;
|
||||
@@ -3450,6 +3466,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
||||
},
|
||||
add_id: function(id) {
|
||||
this.display_value = {};
|
||||
this.display_value_backup = {};
|
||||
this.reinit_value(id);
|
||||
},
|
||||
is_false: function() {
|
||||
|
||||
@@ -522,6 +522,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
|
||||
return x;
|
||||
}
|
||||
});
|
||||
this.ActionManager = parent;
|
||||
this.views = {};
|
||||
this.flags = flags || {};
|
||||
this.registry = instance.web.views;
|
||||
@@ -1253,6 +1254,7 @@ instance.web.View = instance.web.Widget.extend({
|
||||
view_type: undefined,
|
||||
init: function(parent, dataset, view_id, options) {
|
||||
this._super(parent);
|
||||
this.ViewManager = parent;
|
||||
this.dataset = dataset;
|
||||
this.view_id = view_id;
|
||||
this.set_default_options(options);
|
||||
@@ -1324,7 +1326,6 @@ instance.web.View = instance.web.Widget.extend({
|
||||
}
|
||||
};
|
||||
var context = new instance.web.CompoundContext(dataset.get_context(), action_data.context || {});
|
||||
|
||||
var handler = function (action) {
|
||||
if (action && action.constructor == Object) {
|
||||
var ncontext = new instance.web.CompoundContext(context);
|
||||
@@ -1361,7 +1362,11 @@ instance.web.View = instance.web.Widget.extend({
|
||||
}
|
||||
}
|
||||
args.push(context);
|
||||
return dataset.call_button(action_data.name, args).then(handler);
|
||||
return dataset.call_button(action_data.name, args).then(handler).then(function () {
|
||||
if (self.ViewManager.ActionManager) {
|
||||
self.ViewManager.ActionManager.__parentedParent.menu.do_reload_needaction();
|
||||
}
|
||||
});
|
||||
} else if (action_data.type=="action") {
|
||||
return this.rpc('/web/action/load', {
|
||||
action_id: action_data.name,
|
||||
|
||||
Reference in New Issue
Block a user