2011-03-16 23:56:34 +00:00
|
|
|
/*---------------------------------------------------------
|
|
|
|
* OpenERP base library
|
|
|
|
*---------------------------------------------------------*/
|
|
|
|
|
2011-03-30 14:35:56 +00:00
|
|
|
openerp.base.chrome = function(openerp) {
|
2011-03-16 23:56:34 +00:00
|
|
|
|
2011-03-20 20:01:17 +00:00
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Notification = openerp.base.Widget.extend({
|
2011-07-18 12:54:22 +00:00
|
|
|
init: function(parent, element_id) {
|
|
|
|
this._super(parent, element_id);
|
2011-07-22 11:21:08 +00:00
|
|
|
this.$element.notify({
|
|
|
|
speed: 500,
|
|
|
|
expires: 1500
|
2011-04-10 00:12:22 +00:00
|
|
|
});
|
|
|
|
},
|
2011-07-22 11:21:08 +00:00
|
|
|
notify: function(title, text) {
|
|
|
|
this.$element.notify('create', {
|
|
|
|
title: title,
|
|
|
|
text: text
|
|
|
|
});
|
2011-04-10 00:12:22 +00:00
|
|
|
},
|
2011-07-22 11:21:08 +00:00
|
|
|
warn: function(title, text) {
|
|
|
|
this.$element.notify('create', 'oe_notification_alert', {
|
|
|
|
title: title,
|
|
|
|
text: text
|
|
|
|
});
|
2011-04-10 00:12:22 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Dialog = openerp.base.OldWidget.extend({
|
2011-06-16 14:37:11 +00:00
|
|
|
dialog_title: "",
|
|
|
|
identifier_prefix: 'dialog',
|
2011-08-08 17:14:07 +00:00
|
|
|
init: function (parent, dialog_options) {
|
2011-07-26 10:01:36 +00:00
|
|
|
var self = this;
|
2011-07-18 12:54:22 +00:00
|
|
|
this._super(parent);
|
2011-08-08 17:14:07 +00:00
|
|
|
this.dialog_options = {
|
2011-06-16 14:37:11 +00:00
|
|
|
modal: true,
|
2011-06-21 12:07:50 +00:00
|
|
|
width: 'auto',
|
2011-06-16 14:37:11 +00:00
|
|
|
min_width: 0,
|
|
|
|
max_width: '100%',
|
2011-06-21 12:07:50 +00:00
|
|
|
height: 'auto',
|
2011-06-16 14:37:11 +00:00
|
|
|
min_height: 0,
|
|
|
|
max_height: '100%',
|
2011-06-21 12:07:50 +00:00
|
|
|
autoOpen: false,
|
2011-07-26 10:01:36 +00:00
|
|
|
buttons: {},
|
2011-08-10 22:23:54 +00:00
|
|
|
beforeClose: function () { self.on_close(); }
|
2011-06-21 12:07:50 +00:00
|
|
|
};
|
2011-06-16 14:37:11 +00:00
|
|
|
for (var f in this) {
|
|
|
|
if (f.substr(0, 10) == 'on_button_') {
|
2011-08-08 17:14:07 +00:00
|
|
|
this.dialog_options.buttons[f.substr(10)] = this[f];
|
2011-06-16 14:37:11 +00:00
|
|
|
}
|
|
|
|
}
|
2011-08-08 17:14:07 +00:00
|
|
|
if (dialog_options) {
|
|
|
|
this.set_options(dialog_options);
|
2011-06-21 12:07:50 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
set_options: function(options) {
|
|
|
|
options = options || {};
|
2011-08-09 07:47:12 +00:00
|
|
|
options.width = this.get_width(options.width || this.dialog_options.width);
|
|
|
|
options.min_width = this.get_width(options.min_width || this.dialog_options.min_width);
|
|
|
|
options.max_width = this.get_width(options.max_width || this.dialog_options.max_width);
|
|
|
|
options.height = this.get_height(options.height || this.dialog_options.height);
|
|
|
|
options.min_height = this.get_height(options.min_height || this.dialog_options.min_height);
|
|
|
|
options.max_height = this.get_height(options.max_height || this.dialog_options.max_width);
|
2011-06-21 12:07:50 +00:00
|
|
|
|
|
|
|
if (options.width !== 'auto') {
|
|
|
|
if (options.width > options.max_width) options.width = options.max_width;
|
|
|
|
if (options.width < options.min_width) options.width = options.min_width;
|
|
|
|
}
|
|
|
|
if (options.height !== 'auto') {
|
|
|
|
if (options.height > options.max_height) options.height = options.max_height;
|
|
|
|
if (options.height < options.min_height) options.height = options.min_height;
|
|
|
|
}
|
|
|
|
if (!options.title && this.dialog_title) {
|
|
|
|
options.title = this.dialog_title;
|
|
|
|
}
|
2011-08-08 17:14:07 +00:00
|
|
|
_.extend(this.dialog_options, options);
|
2011-06-16 14:37:11 +00:00
|
|
|
},
|
|
|
|
get_width: function(val) {
|
|
|
|
return this.get_size(val.toString(), $(window.top).width());
|
|
|
|
},
|
|
|
|
get_height: function(val) {
|
|
|
|
return this.get_size(val.toString(), $(window.top).height());
|
|
|
|
},
|
|
|
|
get_size: function(val, available_size) {
|
2011-06-21 12:07:50 +00:00
|
|
|
if (val === 'auto') {
|
2011-06-16 14:37:11 +00:00
|
|
|
return val;
|
|
|
|
} else if (val.slice(-1) == "%") {
|
|
|
|
return Math.round(available_size / 100 * parseInt(val.slice(0, -1), 10));
|
|
|
|
} else {
|
|
|
|
return parseInt(val, 10);
|
|
|
|
}
|
|
|
|
},
|
2011-08-10 12:05:48 +00:00
|
|
|
start: function () {
|
2011-08-08 17:14:07 +00:00
|
|
|
this.$dialog = $('<div id="' + this.element_id + '"></div>').dialog(this.dialog_options);
|
2011-06-16 14:37:11 +00:00
|
|
|
this._super();
|
2011-08-10 11:49:14 +00:00
|
|
|
return this;
|
2011-06-16 14:37:11 +00:00
|
|
|
},
|
2011-08-08 17:14:07 +00:00
|
|
|
open: function(dialog_options) {
|
2011-06-21 12:07:50 +00:00
|
|
|
// TODO fme: bind window on resize
|
|
|
|
if (this.template) {
|
|
|
|
this.$element.html(this.render());
|
|
|
|
}
|
2011-08-08 17:14:07 +00:00
|
|
|
this.set_options(dialog_options);
|
|
|
|
this.$dialog.dialog(this.dialog_options).dialog('open');
|
2011-06-21 12:07:50 +00:00
|
|
|
},
|
2011-07-27 15:05:42 +00:00
|
|
|
close: function() {
|
|
|
|
// Closes the dialog but leave it in a state where it could be opened again.
|
|
|
|
this.$dialog.dialog('close');
|
|
|
|
},
|
|
|
|
on_close: function() {
|
|
|
|
},
|
2011-06-16 14:37:11 +00:00
|
|
|
stop: function () {
|
2011-07-27 15:05:42 +00:00
|
|
|
// Destroy widget
|
|
|
|
this.close();
|
2011-06-21 12:07:50 +00:00
|
|
|
this.$dialog.dialog('destroy');
|
2011-06-16 14:37:11 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-06-21 12:10:02 +00:00
|
|
|
openerp.base.CrashManager = openerp.base.Dialog.extend({
|
|
|
|
identifier_prefix: 'dialog_crash',
|
2011-07-18 12:54:22 +00:00
|
|
|
init: function(parent) {
|
|
|
|
this._super(parent);
|
2011-04-06 21:10:37 +00:00
|
|
|
this.session.on_rpc_error.add(this.on_rpc_error);
|
|
|
|
},
|
2011-06-21 12:10:02 +00:00
|
|
|
on_button_Ok: function() {
|
|
|
|
this.close();
|
2011-04-06 21:10:37 +00:00
|
|
|
},
|
2011-06-21 12:10:02 +00:00
|
|
|
on_rpc_error: function(error) {
|
|
|
|
this.error = error;
|
2011-06-22 14:57:57 +00:00
|
|
|
if (error.data.fault_code) {
|
|
|
|
var split = error.data.fault_code.split('\n')[0].split(' -- ');
|
|
|
|
if (split.length > 1) {
|
|
|
|
error.type = split.shift();
|
|
|
|
error.data.fault_code = error.data.fault_code.substr(error.type.length + 4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error.code === 200 && error.type) {
|
|
|
|
this.dialog_title = "OpenERP " + _.capitalize(error.type);
|
2011-06-21 12:10:02 +00:00
|
|
|
this.template = 'DialogWarning';
|
|
|
|
this.open({
|
|
|
|
width: 'auto',
|
|
|
|
height: 'auto'
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.dialog_title = "OpenERP Error";
|
|
|
|
this.template = 'DialogTraceback';
|
|
|
|
this.open({
|
2011-07-04 13:18:38 +00:00
|
|
|
width: 'auto',
|
|
|
|
height: 'auto'
|
2011-06-21 12:10:02 +00:00
|
|
|
});
|
|
|
|
}
|
2011-04-06 21:10:37 +00:00
|
|
|
}
|
2011-04-04 19:52:16 +00:00
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Loading = openerp.base.Widget.extend({
|
2011-07-18 12:54:22 +00:00
|
|
|
init: function(parent, element_id) {
|
|
|
|
this._super(parent, element_id);
|
2011-03-16 23:56:34 +00:00
|
|
|
this.count = 0;
|
|
|
|
this.session.on_rpc_request.add_first(this.on_rpc_event, 1);
|
|
|
|
this.session.on_rpc_response.add_last(this.on_rpc_event, -1);
|
|
|
|
},
|
|
|
|
on_rpc_event : function(increment) {
|
|
|
|
this.count += increment;
|
|
|
|
if (this.count) {
|
|
|
|
//this.$element.html(QWeb.render("Loading", {}));
|
|
|
|
this.$element.html("Loading ("+this.count+")");
|
|
|
|
this.$element.show();
|
|
|
|
} else {
|
|
|
|
this.$element.fadeOut();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Database = openerp.base.Widget.extend({
|
2011-07-26 08:03:18 +00:00
|
|
|
init: function(parent, element_id, option_id) {
|
|
|
|
this._super(parent, element_id);
|
|
|
|
this.$option_id = $('#' + option_id);
|
|
|
|
},
|
|
|
|
start: function() {
|
|
|
|
this.$element.html(QWeb.render("Database", this));
|
2011-08-01 09:16:36 +00:00
|
|
|
this.$element.closest(".openerp")
|
|
|
|
.removeClass("login-mode")
|
|
|
|
.addClass("database_block");
|
2011-06-29 06:17:55 +00:00
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
2011-08-02 09:18:49 +00:00
|
|
|
var fetch_db = this.rpc("/base/database/get_list", {}, function(result) {
|
2011-06-29 18:15:57 +00:00
|
|
|
self.db_list = result.db_list;
|
|
|
|
});
|
2011-08-01 09:31:30 +00:00
|
|
|
var fetch_langs = this.rpc("/base/session/get_lang_list", {}, function(result) {
|
2011-08-02 09:20:16 +00:00
|
|
|
if (result.error) {
|
|
|
|
self.display_error(result);
|
|
|
|
return;
|
2011-07-26 08:20:02 +00:00
|
|
|
}
|
2011-08-02 09:20:16 +00:00
|
|
|
self.lang_list = result.lang_list;
|
2011-07-01 06:58:42 +00:00
|
|
|
});
|
2011-08-02 09:18:49 +00:00
|
|
|
$.when(fetch_db, fetch_langs).then(function () {self.do_create();});
|
2011-07-01 06:58:42 +00:00
|
|
|
|
2011-08-02 09:18:49 +00:00
|
|
|
this.$element.find('#db-create').click(this.do_create);
|
|
|
|
this.$element.find('#db-drop').click(this.do_drop);
|
|
|
|
this.$element.find('#db-backup').click(this.do_backup);
|
|
|
|
this.$element.find('#db-restore').click(this.do_restore);
|
2011-07-13 07:07:12 +00:00
|
|
|
this.$element.find('#db-change-password').click(this.do_change_password);
|
|
|
|
this.$element.find('#back-to-login').click(function() {
|
2011-08-02 08:10:22 +00:00
|
|
|
self.stop();
|
2011-07-26 08:03:18 +00:00
|
|
|
});
|
|
|
|
},
|
2011-08-02 08:10:22 +00:00
|
|
|
stop: function () {
|
|
|
|
this.$option_id.empty();
|
|
|
|
|
|
|
|
this.$element
|
|
|
|
.find('#db-create, #db-drop, #db-backup, #db-restore, #db-change-password, #back-to-login')
|
|
|
|
.unbind('click')
|
|
|
|
.end()
|
|
|
|
.closest(".openerp")
|
|
|
|
.addClass("login-mode")
|
|
|
|
.removeClass("database_block")
|
|
|
|
.end()
|
|
|
|
.empty();
|
|
|
|
|
|
|
|
},
|
2011-08-01 09:56:49 +00:00
|
|
|
/**
|
|
|
|
* Converts a .serializeArray() result into a dict. Does not bother folding
|
|
|
|
* multiple identical keys into an array, last key wins.
|
|
|
|
*
|
|
|
|
* @param {Array} array
|
|
|
|
*/
|
|
|
|
to_object: function (array) {
|
|
|
|
var result = {};
|
|
|
|
_(array).each(function (record) {
|
|
|
|
result[record.name] = record.value;
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
},
|
2011-08-02 07:25:51 +00:00
|
|
|
/**
|
|
|
|
* Waits until the new database is done creating, then unblocks the UI and
|
|
|
|
* logs the user in as admin
|
|
|
|
*
|
|
|
|
* @param {Number} db_creation_id identifier for the db-creation operation, used to fetch the current installation progress
|
|
|
|
* @param {Object} info info fields for this database creation
|
|
|
|
* @param {String} info.db name of the database being created
|
|
|
|
* @param {String} info.password super-admin password for the database
|
|
|
|
*/
|
|
|
|
wait_for_newdb: function (db_creation_id, info) {
|
2011-08-02 07:00:07 +00:00
|
|
|
var self = this;
|
|
|
|
self.rpc('/base/database/progress', {
|
|
|
|
id: db_creation_id,
|
2011-08-02 07:25:51 +00:00
|
|
|
password: info.password
|
2011-08-02 07:00:07 +00:00
|
|
|
}, function (result) {
|
|
|
|
var progress = result[0];
|
|
|
|
// I'd display a progress bar, but turns out the progress status
|
|
|
|
// the server report kind-of blows goats: it's at 0 for ~75% of
|
|
|
|
// the installation, then jumps to 75%, then jumps down to either
|
|
|
|
// 0 or ~40%, then back up to 75%, then terminates. Let's keep that
|
|
|
|
// mess hidden behind a not-very-useful but not overly weird
|
|
|
|
// message instead.
|
|
|
|
if (progress < 1) {
|
|
|
|
setTimeout(function () {
|
2011-08-02 07:25:51 +00:00
|
|
|
self.wait_for_newdb(db_creation_id, info);
|
2011-08-02 07:00:07 +00:00
|
|
|
}, 500);
|
|
|
|
return;
|
|
|
|
}
|
2011-08-02 07:25:51 +00:00
|
|
|
|
|
|
|
var admin = result[1][0];
|
2011-08-02 08:28:03 +00:00
|
|
|
setTimeout(function () {
|
|
|
|
self.stop();
|
2011-08-02 09:53:31 +00:00
|
|
|
self.widget_parent.do_login(
|
2011-08-02 08:28:03 +00:00
|
|
|
info.db, admin.login, admin.password);
|
|
|
|
$.unblockUI();
|
|
|
|
});
|
2011-08-02 07:00:07 +00:00
|
|
|
});
|
|
|
|
},
|
2011-08-02 09:13:44 +00:00
|
|
|
/**
|
|
|
|
* Displays an error dialog resulting from the various RPC communications
|
|
|
|
* failing over themselves
|
|
|
|
*
|
|
|
|
* @param {Object} error error description
|
|
|
|
* @param {String} error.title title of the error dialog
|
|
|
|
* @param {String} error.error message of the error dialog
|
|
|
|
*/
|
|
|
|
display_error: function (error) {
|
|
|
|
return $('<div>').dialog({
|
|
|
|
modal: true,
|
|
|
|
title: error.title,
|
|
|
|
buttons: {
|
|
|
|
Ok: function() {
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).html(error.error);
|
|
|
|
},
|
2011-08-02 09:18:49 +00:00
|
|
|
do_create: function() {
|
2011-07-26 08:03:18 +00:00
|
|
|
var self = this;
|
2011-07-13 07:07:12 +00:00
|
|
|
self.$option_id.html(QWeb.render("CreateDB", self));
|
2011-08-01 10:44:53 +00:00
|
|
|
|
|
|
|
self.$option_id.find("form[name=create_db_form]").validate({
|
|
|
|
submitHandler: function (form) {
|
|
|
|
var fields = $(form).serializeArray();
|
2011-08-02 07:00:07 +00:00
|
|
|
$.blockUI();
|
2011-08-02 09:18:49 +00:00
|
|
|
self.rpc("/base/database/create", {'fields': fields}, function(result) {
|
2011-08-02 09:13:44 +00:00
|
|
|
if (result.error) {
|
2011-08-02 07:00:07 +00:00
|
|
|
$.unblockUI();
|
2011-08-02 09:13:44 +00:00
|
|
|
self.display_error(result);
|
|
|
|
return;
|
2011-08-01 10:44:53 +00:00
|
|
|
}
|
2011-08-02 09:13:44 +00:00
|
|
|
self.db_list.push(self.to_object(fields)['db_name']);
|
|
|
|
self.db_list.sort();
|
|
|
|
var form_obj = self.to_object(fields);
|
|
|
|
self.wait_for_newdb(result, {
|
|
|
|
password: form_obj['super_admin_pwd'],
|
|
|
|
db: form_obj['db_name']
|
|
|
|
});
|
2011-08-01 10:44:53 +00:00
|
|
|
});
|
|
|
|
}
|
2011-07-26 08:03:18 +00:00
|
|
|
});
|
2011-07-13 07:07:12 +00:00
|
|
|
},
|
|
|
|
|
2011-08-02 09:18:49 +00:00
|
|
|
do_drop: function() {
|
2011-07-26 08:03:18 +00:00
|
|
|
var self = this;
|
2011-07-13 07:07:12 +00:00
|
|
|
self.$option_id.html(QWeb.render("DropDB", self));
|
|
|
|
|
2011-08-01 10:44:53 +00:00
|
|
|
self.$option_id.find("form[name=drop_db_form]").validate({
|
|
|
|
submitHandler: function (form) {
|
|
|
|
var $form = $(form),
|
|
|
|
fields = $form.serializeArray(),
|
|
|
|
$db_list = $form.find('select[name=drop_db]'),
|
|
|
|
db = $db_list.val();
|
|
|
|
|
|
|
|
if (!confirm("Do you really want to delete the database: " + db + " ?")) {
|
|
|
|
return;
|
|
|
|
}
|
2011-08-02 09:18:49 +00:00
|
|
|
self.rpc("/base/database/drop", {'fields': fields}, function(result) {
|
2011-08-02 09:13:44 +00:00
|
|
|
if (result.error) {
|
|
|
|
self.display_error(result);
|
|
|
|
return;
|
2011-08-01 09:17:33 +00:00
|
|
|
}
|
2011-08-02 09:13:44 +00:00
|
|
|
$db_list.find(':selected').remove();
|
|
|
|
self.db_list.splice(_.indexOf(self.db_list, db, true), 1);
|
|
|
|
self.notification.notify("Dropping database", "The database '" + db + "' has been dropped");
|
2011-08-01 09:17:33 +00:00
|
|
|
});
|
|
|
|
}
|
2011-06-29 18:15:57 +00:00
|
|
|
});
|
2011-07-13 07:07:12 +00:00
|
|
|
},
|
2011-08-01 13:12:54 +00:00
|
|
|
|
|
|
|
wait_for_file: function (token, cleanup) {
|
2011-08-02 09:28:45 +00:00
|
|
|
var self = this,
|
|
|
|
cookie_name = 'fileToken',
|
2011-08-01 13:12:54 +00:00
|
|
|
cookie_length = cookie_name.length;
|
2011-08-02 09:28:45 +00:00
|
|
|
this.backup_timer = setInterval(function () {
|
2011-08-01 13:12:54 +00:00
|
|
|
var cookies = document.cookie.split(';');
|
|
|
|
for(var i=0; i<cookies.length; ++i) {
|
|
|
|
var cookie = cookies[i].replace(/^\s*/, '');
|
|
|
|
if(!cookie.indexOf(cookie_name) === 0) { continue; }
|
|
|
|
var cookie_val = cookie.substring(cookie_length + 1);
|
|
|
|
if(parseInt(cookie_val, 10) !== token) { continue; }
|
|
|
|
|
|
|
|
// clear waiter
|
2011-08-02 09:28:45 +00:00
|
|
|
clearInterval(self.backup_timer);
|
2011-08-01 13:12:54 +00:00
|
|
|
// clear cookie
|
|
|
|
document.cookie = _.sprintf("%s=;expires=%s;path=/",
|
|
|
|
cookie_name, new Date().toGMTString());
|
|
|
|
|
|
|
|
if (cleanup) { cleanup(); }
|
|
|
|
}
|
|
|
|
}, 100);
|
|
|
|
},
|
2011-08-02 09:18:49 +00:00
|
|
|
do_backup: function() {
|
2011-07-26 08:03:18 +00:00
|
|
|
var self = this;
|
2011-07-13 07:07:12 +00:00
|
|
|
self.$option_id.html(QWeb.render("BackupDB", self));
|
2011-08-01 10:44:53 +00:00
|
|
|
|
|
|
|
self.$option_id.find("form[name=backup_db_form]").validate({
|
|
|
|
submitHandler: function (form) {
|
2011-08-02 08:43:12 +00:00
|
|
|
$.blockUI();
|
2011-08-01 13:12:54 +00:00
|
|
|
// need to detect when the file is done downloading (not used
|
|
|
|
// yet, but we'll need it to fix the UI e.g. with a throbber
|
|
|
|
// while dump is being generated), iframe load event only fires
|
|
|
|
// when the iframe content loads, so we need to go smarter:
|
|
|
|
// http://geekswithblogs.net/GruffCode/archive/2010/10/28/detecting-the-file-download-dialog-in-the-browser.aspx
|
|
|
|
var $target = $('#backup-target'),
|
|
|
|
token = new Date().getTime();
|
|
|
|
if (!$target.length) {
|
|
|
|
$target = $('<iframe id="backup-target" style="display: none;">')
|
2011-08-02 09:28:45 +00:00
|
|
|
.appendTo(document.body)
|
|
|
|
.load(function () {
|
|
|
|
$.unblockUI();
|
|
|
|
clearInterval(self.backup_timer);
|
|
|
|
var error = this.contentDocument.body
|
|
|
|
.firstChild.data
|
|
|
|
.split('|');
|
|
|
|
self.display_error({
|
|
|
|
title: error[0],
|
|
|
|
error: error[1]
|
|
|
|
});
|
|
|
|
});
|
2011-08-01 13:12:54 +00:00
|
|
|
}
|
|
|
|
$(form).find('input[name=token]').val(token);
|
|
|
|
form.submit();
|
2011-08-01 10:44:53 +00:00
|
|
|
|
2011-08-02 08:43:12 +00:00
|
|
|
self.wait_for_file(token, function () {
|
|
|
|
$.unblockUI();
|
|
|
|
});
|
2011-08-01 10:44:53 +00:00
|
|
|
}
|
|
|
|
});
|
2011-07-13 07:07:12 +00:00
|
|
|
},
|
|
|
|
|
2011-08-02 09:18:49 +00:00
|
|
|
do_restore: function() {
|
2011-07-26 08:03:18 +00:00
|
|
|
var self = this;
|
2011-07-13 07:07:12 +00:00
|
|
|
self.$option_id.html(QWeb.render("RestoreDB", self));
|
|
|
|
|
2011-08-01 10:44:53 +00:00
|
|
|
self.$option_id.find("form[name=restore_db_form]").validate({
|
|
|
|
submitHandler: function (form) {
|
2011-08-02 08:43:12 +00:00
|
|
|
$.blockUI();
|
2011-08-01 14:47:28 +00:00
|
|
|
$(form).ajaxSubmit({
|
2011-08-02 09:18:49 +00:00
|
|
|
url: '/base/database/restore',
|
2011-08-01 14:47:28 +00:00
|
|
|
type: 'POST',
|
|
|
|
resetForm: true,
|
2011-08-02 09:13:44 +00:00
|
|
|
success: function (body) {
|
2011-08-01 14:47:28 +00:00
|
|
|
// TODO: ui manipulations
|
2011-08-02 09:13:44 +00:00
|
|
|
// note: response objects don't work, but we have the
|
|
|
|
// HTTP body of the response~~
|
|
|
|
|
|
|
|
// If empty body, everything went fine
|
|
|
|
if (!body) { return; }
|
|
|
|
|
|
|
|
if (body.indexOf('403 Forbidden') !== -1) {
|
|
|
|
self.display_error({
|
|
|
|
title: 'Access Denied',
|
|
|
|
error: 'Incorrect super-administrator password'
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
self.display_error({
|
|
|
|
title: 'Restore Database',
|
|
|
|
error: 'Could not restore the database'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
complete: function () {
|
2011-08-02 08:43:12 +00:00
|
|
|
$.unblockUI();
|
2011-08-01 10:44:53 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2011-07-26 08:03:18 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
do_change_password: function() {
|
|
|
|
var self = this;
|
2011-07-13 07:07:12 +00:00
|
|
|
self.$option_id.html(QWeb.render("Change_DB_Pwd", self));
|
2011-07-26 08:03:18 +00:00
|
|
|
|
2011-08-01 10:44:53 +00:00
|
|
|
self.$option_id.find("form[name=change_pwd_form]").validate({
|
|
|
|
messages: {
|
|
|
|
old_pwd: "Please enter your previous password",
|
|
|
|
new_pwd: "Please enter your new password",
|
|
|
|
confirm_pwd: {
|
|
|
|
required: "Please confirm your new password",
|
|
|
|
equalTo: "The confirmation does not match the password"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
submitHandler: function (form) {
|
2011-08-02 09:18:49 +00:00
|
|
|
self.rpc("/base/database/change_password", {
|
2011-08-02 09:13:44 +00:00
|
|
|
'fields': $(form).serializeArray()
|
|
|
|
}, function(result) {
|
|
|
|
if (result.error) {
|
|
|
|
self.display_error(result);
|
|
|
|
return;
|
2011-08-01 10:44:53 +00:00
|
|
|
}
|
2011-08-02 09:13:44 +00:00
|
|
|
self.notification.notify("Changed Password", "Password has been changed successfully");
|
2011-08-01 10:44:53 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2011-07-26 08:03:18 +00:00
|
|
|
}
|
2011-04-05 15:53:48 +00:00
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Login = openerp.base.Widget.extend({
|
2011-07-04 15:32:59 +00:00
|
|
|
remember_creditentials: true,
|
2011-07-05 04:38:11 +00:00
|
|
|
|
2011-07-18 12:54:22 +00:00
|
|
|
init: function(parent, element_id) {
|
|
|
|
this._super(parent, element_id);
|
2011-06-08 09:44:26 +00:00
|
|
|
this.has_local_storage = typeof(localStorage) != 'undefined';
|
|
|
|
this.selected_db = null;
|
|
|
|
this.selected_login = null;
|
2011-07-05 04:38:11 +00:00
|
|
|
|
2011-07-04 15:32:59 +00:00
|
|
|
if (this.has_local_storage && this.remember_creditentials) {
|
2011-06-08 09:44:26 +00:00
|
|
|
this.selected_db = localStorage.getItem('last_db_login_success');
|
|
|
|
this.selected_login = localStorage.getItem('last_login_login_success');
|
|
|
|
}
|
2011-07-12 09:11:31 +00:00
|
|
|
if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) {
|
2011-07-12 09:14:31 +00:00
|
|
|
this.selected_db = this.selected_db || "trunk";
|
|
|
|
this.selected_login = this.selected_login || "admin";
|
|
|
|
this.selected_password = this.selected_password || "a";
|
2011-07-12 09:11:31 +00:00
|
|
|
}
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
|
|
|
start: function() {
|
2011-06-06 11:43:06 +00:00
|
|
|
var self = this;
|
2011-08-02 09:18:49 +00:00
|
|
|
this.rpc("/base/database/get_list", {}, function(result) {
|
2011-06-06 11:43:06 +00:00
|
|
|
self.db_list = result.db_list;
|
|
|
|
self.display();
|
|
|
|
}, function() {
|
|
|
|
self.display();
|
|
|
|
});
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
2011-06-08 08:54:07 +00:00
|
|
|
display: function() {
|
2011-06-29 06:17:55 +00:00
|
|
|
var self = this;
|
2011-08-02 08:10:22 +00:00
|
|
|
|
2011-06-06 11:43:06 +00:00
|
|
|
this.$element.html(QWeb.render("Login", this));
|
2011-08-02 08:10:22 +00:00
|
|
|
this.database = new openerp.base.Database(
|
|
|
|
this, "oe_database", "oe_db_options");
|
|
|
|
|
2011-06-29 06:17:55 +00:00
|
|
|
this.$element.find('#oe-db-config').click(function() {
|
2011-07-26 08:03:18 +00:00
|
|
|
self.database.start();
|
2011-06-29 06:17:55 +00:00
|
|
|
});
|
2011-08-02 08:10:22 +00:00
|
|
|
|
2011-06-06 11:43:06 +00:00
|
|
|
this.$element.find("form").submit(this.on_submit);
|
2011-06-08 08:54:07 +00:00
|
|
|
},
|
2011-03-16 23:56:34 +00:00
|
|
|
on_login_invalid: function() {
|
2011-06-06 09:04:54 +00:00
|
|
|
this.$element.closest(".openerp").addClass("login-mode");
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
|
|
|
on_login_valid: function() {
|
2011-06-06 09:04:54 +00:00
|
|
|
this.$element.closest(".openerp").removeClass("login-mode");
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
|
|
|
on_submit: function(ev) {
|
2011-03-17 17:11:51 +00:00
|
|
|
ev.preventDefault();
|
2011-03-16 23:56:34 +00:00
|
|
|
var $e = this.$element;
|
2011-06-06 11:43:06 +00:00
|
|
|
var db = $e.find("form [name=db]").val();
|
2011-03-16 23:56:34 +00:00
|
|
|
var login = $e.find("form input[name=login]").val();
|
|
|
|
var password = $e.find("form input[name=password]").val();
|
2011-08-02 08:28:03 +00:00
|
|
|
|
|
|
|
this.do_login(db, login, password);
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Performs actual login operation, and UI-related stuff
|
|
|
|
*
|
|
|
|
* @param {String} db database to log in
|
|
|
|
* @param {String} login user login
|
|
|
|
* @param {String} password user password
|
|
|
|
*/
|
|
|
|
do_login: function (db, login, password) {
|
|
|
|
var self = this;
|
2011-03-17 15:01:53 +00:00
|
|
|
this.session.session_login(db, login, password, function() {
|
2011-03-20 20:01:17 +00:00
|
|
|
if(self.session.session_is_valid()) {
|
2011-06-08 09:44:26 +00:00
|
|
|
if (self.has_local_storage) {
|
2011-07-04 15:32:59 +00:00
|
|
|
if(self.remember_creditentials) {
|
2011-06-08 09:44:26 +00:00
|
|
|
localStorage.setItem('last_db_login_success', db);
|
|
|
|
localStorage.setItem('last_login_login_success', login);
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('last_db_login_success', '');
|
|
|
|
localStorage.setItem('last_login_login_success', '');
|
|
|
|
}
|
|
|
|
}
|
2011-03-16 23:56:34 +00:00
|
|
|
self.on_login_valid();
|
|
|
|
} else {
|
2011-06-06 11:43:06 +00:00
|
|
|
self.$element.addClass("login_invalid");
|
2011-03-16 23:56:34 +00:00
|
|
|
self.on_login_invalid();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
do_ask_login: function(continuation) {
|
|
|
|
this.on_login_invalid();
|
2011-06-06 11:43:06 +00:00
|
|
|
this.$element
|
|
|
|
.removeClass("login_invalid");
|
2011-03-18 12:19:44 +00:00
|
|
|
this.on_login_valid.add({
|
2011-03-16 23:56:34 +00:00
|
|
|
position: "last",
|
|
|
|
unique: true,
|
2011-03-18 12:19:44 +00:00
|
|
|
callback: continuation
|
|
|
|
});
|
2011-06-06 09:04:54 +00:00
|
|
|
},
|
|
|
|
on_logout: function() {
|
|
|
|
this.session.logout();
|
2011-03-16 23:56:34 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Header = openerp.base.Widget.extend({
|
2011-07-18 12:54:22 +00:00
|
|
|
init: function(parent, element_id) {
|
|
|
|
this._super(parent, element_id);
|
2011-03-20 20:01:17 +00:00
|
|
|
},
|
|
|
|
start: function() {
|
|
|
|
this.do_update();
|
|
|
|
},
|
|
|
|
do_update: function() {
|
|
|
|
this.$element.html(QWeb.render("Header", this));
|
2011-06-06 09:04:54 +00:00
|
|
|
this.$element.find(".logout").click(this.on_logout);
|
|
|
|
},
|
|
|
|
on_logout: function() {}
|
2011-03-20 20:01:17 +00:00
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Menu = openerp.base.Widget.extend({
|
2011-07-18 12:54:22 +00:00
|
|
|
init: function(parent, element_id, secondary_menu_id) {
|
|
|
|
this._super(parent, element_id);
|
2011-03-22 11:49:19 +00:00
|
|
|
this.secondary_menu_id = secondary_menu_id;
|
2011-07-04 13:04:24 +00:00
|
|
|
this.$secondary_menu = $("#" + secondary_menu_id).hide();
|
2011-03-16 23:56:34 +00:00
|
|
|
this.menu = false;
|
|
|
|
},
|
|
|
|
start: function() {
|
|
|
|
this.rpc("/base/menu/load", {}, this.on_loaded);
|
|
|
|
},
|
|
|
|
on_loaded: function(data) {
|
|
|
|
this.data = data;
|
2011-03-22 11:49:19 +00:00
|
|
|
this.$element.html(QWeb.render("Menu", this.data));
|
|
|
|
for (var i = 0; i < this.data.data.children.length; i++) {
|
|
|
|
var v = { menu : this.data.data.children[i] };
|
|
|
|
this.$secondary_menu.append(QWeb.render("Menu.secondary", v));
|
|
|
|
}
|
|
|
|
this.$secondary_menu.find("div.menu_accordion").accordion({
|
|
|
|
animated : false,
|
|
|
|
autoHeight : false,
|
|
|
|
icons : false
|
|
|
|
});
|
|
|
|
this.$secondary_menu.find("div.submenu_accordion").accordion({
|
|
|
|
animated : false,
|
|
|
|
autoHeight : false,
|
|
|
|
active: false,
|
|
|
|
collapsible: true,
|
|
|
|
header: 'h4'
|
2011-03-16 23:56:34 +00:00
|
|
|
});
|
2011-03-22 11:49:19 +00:00
|
|
|
|
|
|
|
this.$element.add(this.$secondary_menu).find("a").click(this.on_menu_click);
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
2011-03-22 11:49:19 +00:00
|
|
|
on_menu_click: function(ev, id) {
|
2011-03-25 13:21:15 +00:00
|
|
|
id = id || 0;
|
|
|
|
var $menu, $parent, $secondary;
|
|
|
|
|
2011-03-22 11:49:19 +00:00
|
|
|
if (id) {
|
|
|
|
// We can manually activate a menu with it's id (for hash url mapping)
|
2011-03-25 13:21:15 +00:00
|
|
|
$menu = this.$element.find('a[data-menu=' + id + ']');
|
2011-03-22 11:49:19 +00:00
|
|
|
if (!$menu.length) {
|
2011-03-25 13:21:15 +00:00
|
|
|
$menu = this.$secondary_menu.find('a[data-menu=' + id + ']');
|
2011-03-22 11:49:19 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$menu = $(ev.currentTarget);
|
2011-03-25 13:21:15 +00:00
|
|
|
id = $menu.data('menu');
|
2011-03-22 11:49:19 +00:00
|
|
|
}
|
|
|
|
if (this.$secondary_menu.has($menu).length) {
|
|
|
|
$secondary = $menu.parents('.menu_accordion');
|
2011-03-25 13:21:15 +00:00
|
|
|
$parent = this.$element.find('a[data-menu=' + $secondary.data('menu-parent') + ']');
|
2011-03-22 11:49:19 +00:00
|
|
|
} else {
|
|
|
|
$parent = $menu;
|
|
|
|
$secondary = this.$secondary_menu.find('.menu_accordion[data-menu-parent=' + $menu.attr('data-menu') + ']');
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$secondary_menu.find('.menu_accordion').hide();
|
|
|
|
// TODO: ui-accordion : collapse submenus and expand the good one
|
|
|
|
$secondary.show();
|
2011-03-25 13:23:51 +00:00
|
|
|
|
|
|
|
if (id) {
|
|
|
|
this.rpc('/base/menu/action', {'menu_id': id},
|
|
|
|
this.on_menu_action_loaded);
|
|
|
|
}
|
2011-03-22 11:49:19 +00:00
|
|
|
|
2011-07-04 13:04:24 +00:00
|
|
|
$('.active', this.$element.add(this.$secondary_menu.show())).removeClass('active');
|
2011-03-22 11:49:19 +00:00
|
|
|
$parent.addClass('active');
|
|
|
|
$menu.addClass('active');
|
|
|
|
$menu.parent('h4').addClass('active');
|
|
|
|
|
|
|
|
return !$menu.is(".leaf");
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
|
|
|
on_menu_action_loaded: function(data) {
|
|
|
|
var self = this;
|
2011-03-22 11:49:19 +00:00
|
|
|
if (data.action.length) {
|
2011-03-16 23:56:34 +00:00
|
|
|
var action = data.action[0][2];
|
|
|
|
self.on_action(action);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
on_action: function(action) {
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Homepage = openerp.base.Widget.extend({
|
2011-03-16 23:56:34 +00:00
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Preferences = openerp.base.Widget.extend({
|
2011-03-16 23:56:34 +00:00
|
|
|
});
|
|
|
|
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.WebClient = openerp.base.Widget.extend({
|
2011-03-16 23:56:34 +00:00
|
|
|
init: function(element_id) {
|
|
|
|
this._super(null, element_id);
|
2011-08-11 02:42:46 +00:00
|
|
|
openerp.webclient = this;
|
2011-03-16 23:56:34 +00:00
|
|
|
|
2011-07-22 14:28:24 +00:00
|
|
|
QWeb.add_template("/base/static/src/xml/base.xml");
|
2011-04-12 13:19:48 +00:00
|
|
|
var params = {};
|
2011-07-18 12:54:22 +00:00
|
|
|
if(jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()).kitten != undefined) {
|
2011-05-12 07:16:04 +00:00
|
|
|
this.$element.addClass("kitten-mode-activated");
|
2011-04-12 13:19:48 +00:00
|
|
|
}
|
|
|
|
this.$element.html(QWeb.render("Interface", params));
|
2011-03-16 23:56:34 +00:00
|
|
|
|
2011-07-18 12:54:22 +00:00
|
|
|
this.session = new openerp.base.Session(this,"oe_errors");
|
|
|
|
this.loading = new openerp.base.Loading(this,"oe_loading");
|
|
|
|
this.crashmanager = new openerp.base.CrashManager(this);
|
2011-08-10 12:05:48 +00:00
|
|
|
this.crashmanager.start();
|
2011-04-05 15:53:48 +00:00
|
|
|
|
2011-07-22 11:21:08 +00:00
|
|
|
// Do you autorize this ? will be replaced by notify() in controller
|
2011-07-28 14:49:12 +00:00
|
|
|
openerp.base.Widget.prototype.notification = new openerp.base.Notification(this, "oe_notification");
|
2011-04-05 15:53:48 +00:00
|
|
|
|
2011-07-18 12:54:22 +00:00
|
|
|
this.header = new openerp.base.Header(this, "oe_header");
|
|
|
|
this.login = new openerp.base.Login(this, "oe_login");
|
2011-06-06 09:04:54 +00:00
|
|
|
this.header.on_logout.add(this.login.on_logout);
|
2011-03-16 23:56:34 +00:00
|
|
|
|
|
|
|
this.session.on_session_invalid.add(this.login.do_ask_login);
|
2011-03-20 20:01:17 +00:00
|
|
|
this.session.on_session_valid.add_last(this.header.do_update);
|
2011-03-25 08:16:13 +00:00
|
|
|
this.session.on_session_valid.add_last(this.on_logged);
|
2011-03-16 23:56:34 +00:00
|
|
|
|
2011-07-18 12:54:22 +00:00
|
|
|
this.menu = new openerp.base.Menu(this, "oe_menu", "oe_secondary_menu");
|
2011-03-16 23:56:34 +00:00
|
|
|
this.menu.on_action.add(this.on_menu_action);
|
2011-08-10 00:38:57 +00:00
|
|
|
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
|
|
|
start: function() {
|
2011-03-20 20:01:17 +00:00
|
|
|
this.session.start();
|
2011-03-16 23:56:34 +00:00
|
|
|
this.header.start();
|
2011-03-20 20:01:17 +00:00
|
|
|
this.login.start();
|
2011-03-16 23:56:34 +00:00
|
|
|
this.menu.start();
|
2011-04-11 08:30:32 +00:00
|
|
|
this.notification.notify("OpenERP Client", "The openerp client has been initialized.");
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
2011-03-25 08:16:13 +00:00
|
|
|
on_logged: function() {
|
2011-08-10 11:49:14 +00:00
|
|
|
if(this.action_manager)
|
|
|
|
this.action_manager.stop();
|
2011-08-10 00:38:57 +00:00
|
|
|
this.action_manager = new openerp.base.ActionManager(this);
|
|
|
|
this.action_manager.appendTo($("#oe_app"));
|
2011-07-18 12:54:22 +00:00
|
|
|
|
2011-04-11 11:59:33 +00:00
|
|
|
// if using saved actions, load the action and give it to action manager
|
|
|
|
var parameters = jQuery.deparam(jQuery.param.querystring());
|
2011-07-04 14:18:07 +00:00
|
|
|
if (parameters["s_action"] != undefined) {
|
2011-07-04 14:34:02 +00:00
|
|
|
var key = parseInt(parameters["s_action"], 10);
|
2011-04-11 11:59:33 +00:00
|
|
|
var self = this;
|
|
|
|
this.rpc("/base/session/get_session_action", {key:key}, function(action) {
|
2011-04-12 14:07:01 +00:00
|
|
|
self.action_manager.do_action(action);
|
2011-04-11 11:59:33 +00:00
|
|
|
});
|
2011-07-04 14:18:07 +00:00
|
|
|
} else if (openerp._modules_loaded) { // TODO: find better option than this
|
|
|
|
this.load_url_state()
|
|
|
|
} else {
|
|
|
|
this.session.on_modules_loaded.add({
|
|
|
|
callback: $.proxy(this, 'load_url_state'),
|
|
|
|
unique: true,
|
|
|
|
position: 'last'
|
|
|
|
})
|
2011-04-11 11:59:33 +00:00
|
|
|
}
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
2011-07-04 14:18:07 +00:00
|
|
|
/**
|
|
|
|
* Loads state from URL if any, or checks if there is a home action and
|
|
|
|
* loads that, assuming we're at the index
|
|
|
|
*/
|
|
|
|
load_url_state: function () {
|
|
|
|
var self = this;
|
|
|
|
// TODO: add actual loading if there is url state to unpack, test on window.location.hash
|
2011-07-26 15:04:03 +00:00
|
|
|
|
|
|
|
// not logged in
|
|
|
|
if (!this.session.uid) { return; }
|
2011-07-26 12:36:26 +00:00
|
|
|
var ds = new openerp.base.DataSetSearch(this, 'res.users');
|
2011-07-26 15:04:03 +00:00
|
|
|
ds.read_ids([this.session.uid], ['action_id'], function (users) {
|
2011-07-18 15:23:02 +00:00
|
|
|
var home_action = users[0].action_id;
|
2011-07-19 12:32:46 +00:00
|
|
|
if (!home_action) {
|
|
|
|
self.default_home();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
self.execute_home_action(home_action[0], ds);
|
2011-07-04 14:18:07 +00:00
|
|
|
})
|
|
|
|
},
|
2011-08-10 00:38:57 +00:00
|
|
|
default_home: function () {
|
|
|
|
},
|
2011-07-19 12:32:46 +00:00
|
|
|
/**
|
|
|
|
* Bundles the execution of the home action
|
|
|
|
*
|
|
|
|
* @param {Number} action action id
|
|
|
|
* @param {openerp.base.DataSet} dataset action executor
|
|
|
|
*/
|
|
|
|
execute_home_action: function (action, dataset) {
|
2011-07-26 12:53:24 +00:00
|
|
|
var self = this;
|
|
|
|
this.rpc('/base/action/load', {
|
|
|
|
action_id: action,
|
|
|
|
context: dataset.get_context()
|
|
|
|
}, function (meh) {
|
|
|
|
var action = meh.result;
|
|
|
|
action.context = _.extend(action.context || {}, {
|
|
|
|
active_id: false,
|
|
|
|
active_ids: [false],
|
|
|
|
active_model: dataset.model
|
|
|
|
});
|
|
|
|
self.action_manager.do_action(action);
|
|
|
|
});
|
2011-07-19 12:32:46 +00:00
|
|
|
},
|
2011-03-16 23:56:34 +00:00
|
|
|
on_menu_action: function(action) {
|
2011-04-12 14:07:01 +00:00
|
|
|
this.action_manager.do_action(action);
|
2011-03-16 23:56:34 +00:00
|
|
|
},
|
|
|
|
do_about: function() {
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
openerp.base.webclient = function(element_id) {
|
|
|
|
// TODO Helper to start webclient rename it openerp.base.webclient
|
|
|
|
var client = new openerp.base.WebClient(element_id);
|
|
|
|
client.start();
|
|
|
|
return client;
|
|
|
|
};
|
2011-04-09 23:07:27 +00:00
|
|
|
|
2011-03-16 23:56:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|