[imp] refactored chrome.js
bzr revid: nicolas.vanhoren@openerp.com-20120417114837-z4j94uy9f1qstbue
This commit is contained in:
parent
5b89624fcf
commit
e35f513f44
|
@ -1,16 +1,16 @@
|
||||||
/*---------------------------------------------------------
|
/*---------------------------------------------------------
|
||||||
* OpenERP Web chrome
|
* OpenERP Web chrome
|
||||||
*---------------------------------------------------------*/
|
*---------------------------------------------------------*/
|
||||||
openerp.web.chrome = function(openerp) {
|
openerp.web.chrome = function(instance) {
|
||||||
var QWeb = openerp.web.qweb,
|
var QWeb = instance.web.qweb,
|
||||||
_t = openerp.web._t;
|
_t = instance.web._t;
|
||||||
|
|
||||||
openerp.web.Notification = openerp.web.Widget.extend({
|
instance.web.Notification = instance.web.Widget.extend({
|
||||||
template: 'Notification',
|
template: 'Notification',
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
// move to openerp.web.notification
|
// move to instance.web.notification
|
||||||
openerp.notification = this;
|
instance.notification = this;
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
@ -43,13 +43,13 @@ openerp.web.Notification = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.dialog = function(element) {
|
instance.web.dialog = function(element) {
|
||||||
var result = element.dialog.apply(element, _.rest(_.toArray(arguments)));
|
var result = element.dialog.apply(element, _.rest(_.toArray(arguments)));
|
||||||
result.dialog("widget").addClass("openerp");
|
result.dialog("widget").addClass("openerp");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
openerp.web.Dialog = openerp.web.Widget.extend({
|
instance.web.Dialog = instance.web.Widget.extend({
|
||||||
dialog_title: "",
|
dialog_title: "",
|
||||||
init: function (parent, options, content) {
|
init: function (parent, options, content) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -83,7 +83,7 @@ openerp.web.Dialog = openerp.web.Widget.extend({
|
||||||
if (this.dialog_options.autoOpen) {
|
if (this.dialog_options.autoOpen) {
|
||||||
this.open();
|
this.open();
|
||||||
} else {
|
} else {
|
||||||
openerp.web.dialog(this.$element, this.get_options());
|
instance.web.dialog(this.$element, this.get_options());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
get_options: function(options) {
|
get_options: function(options) {
|
||||||
|
@ -122,7 +122,7 @@ openerp.web.Dialog = openerp.web.Widget.extend({
|
||||||
this.$element.html(this.renderElement());
|
this.$element.html(this.renderElement());
|
||||||
}
|
}
|
||||||
var o = this.get_options(options);
|
var o = this.get_options(options);
|
||||||
openerp.web.dialog(this.$element, o).dialog('open');
|
instance.web.dialog(this.$element, o).dialog('open');
|
||||||
if (o.height === 'auto' && o.max_height) {
|
if (o.height === 'auto' && o.max_height) {
|
||||||
this.$element.css({ 'max-height': o.max_height, 'overflow-y': 'auto' });
|
this.$element.css({ 'max-height': o.max_height, 'overflow-y': 'auto' });
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ openerp.web.Dialog = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
|
instance.web.CrashManager = instance.web.CallbackEnabled.extend({
|
||||||
on_rpc_error: function(error) {
|
on_rpc_error: function(error) {
|
||||||
if (error.data.fault_code) {
|
if (error.data.fault_code) {
|
||||||
var split = ("" + error.data.fault_code).split('\n')[0].split(' -- ');
|
var split = ("" + error.data.fault_code).split('\n')[0].split(' -- ');
|
||||||
|
@ -162,7 +162,7 @@ openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_managed_error: function(error) {
|
on_managed_error: function(error) {
|
||||||
openerp.web.dialog($('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>'), {
|
instance.web.dialog($('<div>' + QWeb.render('CrashManager.warning', {error: error}) + '</div>'), {
|
||||||
title: "OpenERP " + _.str.capitalize(error.type),
|
title: "OpenERP " + _.str.capitalize(error.type),
|
||||||
buttons: [
|
buttons: [
|
||||||
{text: _t("Ok"), click: function() { $(this).dialog("close"); }}
|
{text: _t("Ok"), click: function() { $(this).dialog("close"); }}
|
||||||
|
@ -172,14 +172,14 @@ openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
|
||||||
on_traceback: function(error) {
|
on_traceback: function(error) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var buttons = {};
|
var buttons = {};
|
||||||
if (openerp.connection.openerp_entreprise) {
|
if (instance.connection.openerp_entreprise) {
|
||||||
buttons[_t("Send OpenERP Enterprise Report")] = function() {
|
buttons[_t("Send OpenERP Enterprise Report")] = function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var issuename = $('#issuename').val();
|
var issuename = $('#issuename').val();
|
||||||
var explanation = $('#explanation').val();
|
var explanation = $('#explanation').val();
|
||||||
var remark = $('#remark').val();
|
var remark = $('#remark').val();
|
||||||
// Call the send method from server to send mail with details
|
// Call the send method from server to send mail with details
|
||||||
new openerp.web.DataSet(self, 'publisher_warranty.contract').call_and_eval('send', [error.data,explanation,remark,issuename]).then(function(result){
|
new instance.web.DataSet(self, 'publisher_warranty.contract').call_and_eval('send', [error.data,explanation,remark,issuename]).then(function(result){
|
||||||
if (result === false) {
|
if (result === false) {
|
||||||
alert('There was a communication error.')
|
alert('There was a communication error.')
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,7 +195,7 @@ openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var dialog = new openerp.web.Dialog(this, {
|
var dialog = new instance.web.Dialog(this, {
|
||||||
title: "OpenERP " + _.str.capitalize(error.type),
|
title: "OpenERP " + _.str.capitalize(error.type),
|
||||||
width: '80%',
|
width: '80%',
|
||||||
height: '50%',
|
height: '50%',
|
||||||
|
@ -203,11 +203,11 @@ openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
|
||||||
min_height: '600px',
|
min_height: '600px',
|
||||||
buttons: buttons
|
buttons: buttons
|
||||||
}).open();
|
}).open();
|
||||||
dialog.$element.html(QWeb.render('CrashManager.error', {session: openerp.connection, error: error}));
|
dialog.$element.html(QWeb.render('CrashManager.error', {session: instance.connection, error: error}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.Loading = openerp.web.Widget.extend({
|
instance.web.Loading = instance.web.Widget.extend({
|
||||||
template: 'Loading',
|
template: 'Loading',
|
||||||
init: function(parent) {
|
init: function(parent) {
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
|
@ -258,7 +258,7 @@ openerp.web.Loading = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.DatabaseManager = openerp.web.Widget.extend({
|
instance.web.DatabaseManager = instance.web.Widget.extend({
|
||||||
init: function(parent) {
|
init: function(parent) {
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
this.unblockUIFunction = $.unblockUI;
|
this.unblockUIFunction = $.unblockUI;
|
||||||
|
@ -344,7 +344,7 @@ openerp.web.DatabaseManager = openerp.web.Widget.extend({
|
||||||
* @param {String} error.error message of the error dialog
|
* @param {String} error.error message of the error dialog
|
||||||
*/
|
*/
|
||||||
display_error: function (error) {
|
display_error: function (error) {
|
||||||
return openerp.web.dialog($('<div>'), {
|
return instance.web.dialog($('<div>'), {
|
||||||
modal: true,
|
modal: true,
|
||||||
title: error.title,
|
title: error.title,
|
||||||
buttons: [
|
buttons: [
|
||||||
|
@ -388,7 +388,7 @@ openerp.web.DatabaseManager = openerp.web.Widget.extend({
|
||||||
success: function () {
|
success: function () {
|
||||||
self.do_notify(_t("Backed"), _t("Database backed up successfully"));
|
self.do_notify(_t("Backed"), _t("Database backed up successfully"));
|
||||||
},
|
},
|
||||||
error: openerp.webclient.crashmanager.on_rpc_error,
|
error: instance.webclient.crashmanager.on_rpc_error,
|
||||||
complete: function() {
|
complete: function() {
|
||||||
self.unblockUI();
|
self.unblockUI();
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ openerp.web.DatabaseManager = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.Login = openerp.web.Widget.extend({
|
instance.web.Login = instance.web.Widget.extend({
|
||||||
template: "Login",
|
template: "Login",
|
||||||
remember_credentials: true,
|
remember_credentials: true,
|
||||||
init: function(parent) {
|
init: function(parent) {
|
||||||
|
@ -464,7 +464,7 @@ openerp.web.Login = openerp.web.Widget.extend({
|
||||||
self.$element.find('.oe_login_manage_db').click(function() {
|
self.$element.find('.oe_login_manage_db').click(function() {
|
||||||
self.$element.find('.oe_login_bottom').hide();
|
self.$element.find('.oe_login_bottom').hide();
|
||||||
self.$element.find('.oe_login_pane').hide();
|
self.$element.find('.oe_login_pane').hide();
|
||||||
self.databasemanager = new openerp.web.DatabaseManager(self);
|
self.databasemanager = new instance.web.DatabaseManager(self);
|
||||||
self.databasemanager.appendTo(self.$element);
|
self.databasemanager.appendTo(self.$element);
|
||||||
self.databasemanager.do_exit.add_last(function() {
|
self.databasemanager.do_exit.add_last(function() {
|
||||||
self.databasemanager.destroy();
|
self.databasemanager.destroy();
|
||||||
|
@ -486,7 +486,7 @@ openerp.web.Login = openerp.web.Widget.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
set_db_list: function (list) {
|
set_db_list: function (list) {
|
||||||
this.$element.find("[name=db]").replaceWith(openerp.web.qweb.render('Login.dblist', { db_list: list, selected_db: this.selected_db}))
|
this.$element.find("[name=db]").replaceWith(instance.web.qweb.render('Login.dblist', { db_list: list, selected_db: this.selected_db}))
|
||||||
},
|
},
|
||||||
on_submit: function(ev) {
|
on_submit: function(ev) {
|
||||||
if(ev) {
|
if(ev) {
|
||||||
|
@ -538,7 +538,7 @@ openerp.web.Login = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.Menu = openerp.web.Widget.extend({
|
instance.web.Menu = instance.web.Widget.extend({
|
||||||
template: 'Menu',
|
template: 'Menu',
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
@ -682,7 +682,7 @@ openerp.web.Menu = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.UserMenu = openerp.web.Widget.extend({
|
instance.web.UserMenu = instance.web.Widget.extend({
|
||||||
template: "UserMenu",
|
template: "UserMenu",
|
||||||
init: function(parent) {
|
init: function(parent) {
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
|
@ -707,7 +707,7 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
},
|
},
|
||||||
change_password :function() {
|
change_password :function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.dialog = new openerp.web.Dialog(this, {
|
this.dialog = new instance.web.Dialog(this, {
|
||||||
title: _t("Change Password"),
|
title: _t("Change Password"),
|
||||||
width : 'auto'
|
width : 'auto'
|
||||||
}).open();
|
}).open();
|
||||||
|
@ -721,14 +721,14 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
self.display_error(result);
|
self.display_error(result);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
openerp.webclient.on_logout();
|
instance.webclient.on_logout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
display_error: function (error) {
|
display_error: function (error) {
|
||||||
return openerp.web.dialog($('<div>'), {
|
return instance.web.dialog($('<div>'), {
|
||||||
modal: true,
|
modal: true,
|
||||||
title: error.title,
|
title: error.title,
|
||||||
buttons: [
|
buttons: [
|
||||||
|
@ -743,10 +743,10 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
$avatar.attr('src', $avatar.data('default-src'));
|
$avatar.attr('src', $avatar.data('default-src'));
|
||||||
if (!self.session.uid)
|
if (!self.session.uid)
|
||||||
return;
|
return;
|
||||||
var func = new openerp.web.Model("res.users").get_func("read");
|
var func = new instance.web.Model("res.users").get_func("read");
|
||||||
return func(self.session.uid, ["name", "company_id"]).pipe(function(res) {
|
return func(self.session.uid, ["name", "company_id"]).pipe(function(res) {
|
||||||
// TODO: Show company if multicompany is in use
|
// TODO: Show company if multicompany is in use
|
||||||
var topbar_name = _.str.sprintf("%s (%s)", res.name, openerp.connection.db, res.company_id[1]);
|
var topbar_name = _.str.sprintf("%s (%s)", res.name, instance.connection.db, res.company_id[1]);
|
||||||
self.$element.find('.oe_topbar_name').text(topbar_name);
|
self.$element.find('.oe_topbar_name').text(topbar_name);
|
||||||
var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=avatar&id=%s', self.session.prefix, self.session.session_id, self.session.uid);
|
var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=avatar&id=%s', self.session.prefix, self.session.session_id, self.session.uid);
|
||||||
$avatar.attr('src', avatar_src);
|
$avatar.attr('src', avatar_src);
|
||||||
|
@ -760,7 +760,7 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
shortcut_load :function(){
|
shortcut_load :function(){
|
||||||
var self = this,
|
var self = this,
|
||||||
sc = self.session.shortcuts,
|
sc = self.session.shortcuts,
|
||||||
shortcuts_ds = new openerp.web.DataSet(this, 'ir.ui.view_sc');
|
shortcuts_ds = new instance.web.DataSet(this, 'ir.ui.view_sc');
|
||||||
self.$element.find('.oe_dropdown_options a[data-menu=shortcut]').each(function() {
|
self.$element.find('.oe_dropdown_options a[data-menu=shortcut]').each(function() {
|
||||||
$(this).parent().remove();
|
$(this).parent().remove();
|
||||||
});
|
});
|
||||||
|
@ -807,8 +807,8 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
},
|
},
|
||||||
on_menu_settings: function() {
|
on_menu_settings: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var action_manager = new openerp.web.ActionManager(this);
|
var action_manager = new instance.web.ActionManager(this);
|
||||||
var dataset = new openerp.web.DataSet (this,'res.users',this.context);
|
var dataset = new instance.web.DataSet (this,'res.users',this.context);
|
||||||
dataset.call ('action_get','',function (result){
|
dataset.call ('action_get','',function (result){
|
||||||
self.rpc('/web/action/load', {action_id:result}, function(result){
|
self.rpc('/web/action/load', {action_id:result}, function(result){
|
||||||
action_manager.do_action(_.extend(result['result'], {
|
action_manager.do_action(_.extend(result['result'], {
|
||||||
|
@ -825,7 +825,7 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.dialog = new openerp.web.Dialog(this,{
|
this.dialog = new instance.web.Dialog(this,{
|
||||||
title: _t("Preferences"),
|
title: _t("Preferences"),
|
||||||
width: '700px',
|
width: '700px',
|
||||||
buttons: [
|
buttons: [
|
||||||
|
@ -855,7 +855,7 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
window.location = $.param.querystring(
|
window.location = $.param.querystring(
|
||||||
window.location.href, 'debug');
|
window.location.href, 'debug');
|
||||||
});
|
});
|
||||||
openerp.web.dialog($help, {autoOpen: true,
|
instance.web.dialog($help, {autoOpen: true,
|
||||||
modal: true, width: 960, title: _t("About")});
|
modal: true, width: 960, title: _t("About")});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -871,11 +871,11 @@ openerp.web.UserMenu = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.WebClient = openerp.web.Widget.extend({
|
instance.web.WebClient = instance.web.Widget.extend({
|
||||||
init: function(parent) {
|
init: function(parent) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
openerp.webclient = this;
|
instance.webclient = this;
|
||||||
this.querystring = '?' + jQuery.param.querystring();
|
this.querystring = '?' + jQuery.param.querystring();
|
||||||
this._current_state = null;
|
this._current_state = null;
|
||||||
},
|
},
|
||||||
|
@ -900,7 +900,7 @@ openerp.web.WebClient = openerp.web.Widget.extend({
|
||||||
self.menu.do_reload();
|
self.menu.do_reload();
|
||||||
if(self.action_manager)
|
if(self.action_manager)
|
||||||
self.action_manager.destroy();
|
self.action_manager.destroy();
|
||||||
self.action_manager = new openerp.web.ActionManager(self);
|
self.action_manager = new instance.web.ActionManager(self);
|
||||||
self.action_manager.appendTo(self.$element.find('.oe_application'));
|
self.action_manager.appendTo(self.$element.find('.oe_application'));
|
||||||
self.bind_hashchange();
|
self.bind_hashchange();
|
||||||
var version_label = _t("OpenERP - Unsupported/Community Version");
|
var version_label = _t("OpenERP - Unsupported/Community Version");
|
||||||
|
@ -917,7 +917,7 @@ openerp.web.WebClient = openerp.web.Widget.extend({
|
||||||
var self = this;
|
var self = this;
|
||||||
this.destroy_content();
|
this.destroy_content();
|
||||||
this.show_common();
|
this.show_common();
|
||||||
self.login = new openerp.web.Login(self);
|
self.login = new instance.web.Login(self);
|
||||||
self.login.appendTo(self.$element);
|
self.login.appendTo(self.$element);
|
||||||
},
|
},
|
||||||
show_application: function() {
|
show_application: function() {
|
||||||
|
@ -926,10 +926,10 @@ openerp.web.WebClient = openerp.web.Widget.extend({
|
||||||
this.show_common();
|
this.show_common();
|
||||||
self.$table = $(QWeb.render("WebClient", {}));
|
self.$table = $(QWeb.render("WebClient", {}));
|
||||||
self.$element.append(self.$table);
|
self.$element.append(self.$table);
|
||||||
self.menu = new openerp.web.Menu(self);
|
self.menu = new instance.web.Menu(self);
|
||||||
self.menu.replace(this.$element.find('.oe_menu_placeholder'));
|
self.menu.replace(this.$element.find('.oe_menu_placeholder'));
|
||||||
self.menu.on_action.add(this.proxy('on_menu_action'));
|
self.menu.on_action.add(this.proxy('on_menu_action'));
|
||||||
self.user_menu = new openerp.web.UserMenu(self);
|
self.user_menu = new instance.web.UserMenu(self);
|
||||||
self.user_menu.replace(this.$element.find('.oe_user_menu_placeholder'));
|
self.user_menu.replace(this.$element.find('.oe_user_menu_placeholder'));
|
||||||
self.user_menu.on_menu_logout.add(this.proxy('on_logout'));
|
self.user_menu.on_menu_logout.add(this.proxy('on_logout'));
|
||||||
self.user_menu.on_action.add(this.proxy('on_menu_action'));
|
self.user_menu.on_action.add(this.proxy('on_menu_action'));
|
||||||
|
@ -937,8 +937,8 @@ openerp.web.WebClient = openerp.web.Widget.extend({
|
||||||
show_common: function() {
|
show_common: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (!this.crashmanager) {
|
if (!this.crashmanager) {
|
||||||
this.crashmanager = new openerp.web.CrashManager();
|
this.crashmanager = new instance.web.CrashManager();
|
||||||
openerp.connection.on_rpc_error.add(this.crashmanager.on_rpc_error);
|
instance.connection.on_rpc_error.add(this.crashmanager.on_rpc_error);
|
||||||
window.onerror = function (message, file, line) {
|
window.onerror = function (message, file, line) {
|
||||||
self.crashmanager.on_traceback({
|
self.crashmanager.on_traceback({
|
||||||
type: _t("Client Error"),
|
type: _t("Client Error"),
|
||||||
|
@ -947,9 +947,9 @@ openerp.web.WebClient = openerp.web.Widget.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.notification = new openerp.web.Notification(this);
|
this.notification = new instance.web.Notification(this);
|
||||||
this.notification.appendTo(this.$element);
|
this.notification.appendTo(this.$element);
|
||||||
this.loading = new openerp.web.Loading(this);
|
this.loading = new instance.web.Loading(this);
|
||||||
this.loading.appendTo(this.$element);
|
this.loading.appendTo(this.$element);
|
||||||
},
|
},
|
||||||
destroy_content: function() {
|
destroy_content: function() {
|
||||||
|
@ -961,7 +961,7 @@ openerp.web.WebClient = openerp.web.Widget.extend({
|
||||||
do_reload: function() {
|
do_reload: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
return this.session.session_reload().pipe(function () {
|
return this.session.session_reload().pipe(function () {
|
||||||
openerp.connection.load_modules(true).pipe(
|
instance.connection.load_modules(true).pipe(
|
||||||
self.menu.proxy('do_reload')); });
|
self.menu.proxy('do_reload')); });
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1025,14 +1025,14 @@ openerp.web.WebClient = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.EmbeddedClient = openerp.web.Widget.extend({
|
instance.web.EmbeddedClient = instance.web.Widget.extend({
|
||||||
template: 'EmptyComponent',
|
template: 'EmptyComponent',
|
||||||
init: function(parent, action_id, options) {
|
init: function(parent, action_id, options) {
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
// TODO take the xmlid of a action instead of its id
|
// TODO take the xmlid of a action instead of its id
|
||||||
this.action_id = action_id;
|
this.action_id = action_id;
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
this.am = new openerp.web.ActionManager(this);
|
this.am = new instance.web.ActionManager(this);
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -1052,7 +1052,7 @@ openerp.web.EmbeddedClient = openerp.web.Widget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openerp.web.embed = function (origin, dbname, login, key, action, options) {
|
instance.web.embed = function (origin, dbname, login, key, action, options) {
|
||||||
$('head').append($('<link>', {
|
$('head').append($('<link>', {
|
||||||
'rel': 'stylesheet',
|
'rel': 'stylesheet',
|
||||||
'type': 'text/css',
|
'type': 'text/css',
|
||||||
|
@ -1063,9 +1063,9 @@ openerp.web.embed = function (origin, dbname, login, key, action, options) {
|
||||||
var sc = document.getElementsByTagName('script');
|
var sc = document.getElementsByTagName('script');
|
||||||
currentScript = sc[sc.length-1];
|
currentScript = sc[sc.length-1];
|
||||||
}
|
}
|
||||||
openerp.connection.session_bind(origin).then(function () {
|
instance.connection.session_bind(origin).then(function () {
|
||||||
openerp.connection.session_authenticate(dbname, login, key, true).then(function () {
|
instance.connection.session_authenticate(dbname, login, key, true).then(function () {
|
||||||
var client = new openerp.web.EmbeddedClient(null, action, options);
|
var client = new instance.web.EmbeddedClient(null, action, options);
|
||||||
client.insertAfter(currentScript);
|
client.insertAfter(currentScript);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue