summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/boot.js
diff options
context:
space:
mode:
authorKunal Chavda (OpenERP) <kch@tinyerp.com>2011-09-06 18:24:40 +0530
committerKunal Chavda (OpenERP) <kch@tinyerp.com>2011-09-06 18:24:40 +0530
commita9446c53f96bccaf3f8b3a759455ccb65c45efd4 (patch)
tree0ad3e48ab90862c6387dcb464d2728fddf0bbcf7 /addons/web/static/src/js/boot.js
parent1127d2b3e33e012a681b93aaf506af0c698a6ad0 (diff)
parentfd6b4fde142ef971de1eb3daa72ef5a38e8a693c (diff)
[MERGE]Merge with trunk upto revision no 931.
bzr revid: kch@tinyerp.com-20110906125440-turixz49exf0po30
Diffstat (limited to 'addons/web/static/src/js/boot.js')
-rw-r--r--addons/web/static/src/js/boot.js67
1 files changed, 67 insertions, 0 deletions
diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js
new file mode 100644
index 00000000000..2c00eb3d5a5
--- /dev/null
+++ b/addons/web/static/src/js/boot.js
@@ -0,0 +1,67 @@
+/*---------------------------------------------------------
+ * OpenERP Web Boostrap Code
+ *---------------------------------------------------------*/
+
+/**
+ * @name openerp
+ * @namespace openerp
+ * @namespace window.openerp
+ */
+(function() {
+ if (this.openerp)
+ return;
+ var session_counter = 0;
+
+ var openerp = this.openerp = {
+ // Per session namespace
+ // openerp.<module> will map to
+ // openerp.sessions.sessionname.<module> using a closure
+ sessions: {},
+ /**
+ * OpenERP instance constructor
+ *
+ * @param {Boolean} skip_init if true, skips the built-in initialization
+ */
+ init: function(skip_init) {
+ var new_instance = {
+ // links to the global openerp
+ _openerp: openerp,
+ // Only web will be loaded, the rest will be by loaded by
+ // openerp.web.Connection on the first connection
+ _modules_loaded: false,
+ // this unique id will be replaced by hostname_databasename by
+ // openerp.web.Connection on the first connection
+ _session_id: "session" + session_counter++,
+ web: {},
+ web_mobile: {}
+ };
+ openerp.sessions[new_instance._session_id] = new_instance;
+ if (!skip_init){
+ openerp.web(new_instance);
+ }
+ return new_instance;
+ }
+ };
+})();
+
+/*---------------------------------------------------------
+ * OpenERP Web web module split
+ *---------------------------------------------------------*/
+
+openerp.web = function(instance) {
+ openerp.web.core(instance);
+ if (openerp.web.dates) {
+ openerp.web.dates(instance);
+ }
+ openerp.web.formats(instance);
+ openerp.web.chrome(instance);
+ openerp.web.data(instance);
+ var files = ["views","search","list","form","list_editable","web_mobile","view_tree","data_export"];
+ for(var i=0; i<files.length; i++) {
+ if(openerp.web[files[i]]) {
+ openerp.web[files[i]](instance);
+ }
+ }
+};
+
+// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: