diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js index 132d95e309e..5643e0cefb3 100644 --- a/addons/web_gantt/static/src/js/gantt.js +++ b/addons/web_gantt/static/src/js/gantt.js @@ -1,13 +1,13 @@ /*--------------------------------------------------------- * OpenERP web_gantt *---------------------------------------------------------*/ -openerp.web_gantt = function (openerp) { -var _t = openerp.web._t, - _lt = openerp.web._lt; -var QWeb = openerp.web.qweb; -openerp.web.views.add('gantt', 'openerp.web_gantt.GanttView'); +openerp.web_gantt = function (instance) { +var _t = instance.web._t, + _lt = instance.web._lt; +var QWeb = instance.web.qweb; +instance.web.views.add('gantt', 'instance.web_gantt.GanttView'); -openerp.web_gantt.GanttView = openerp.web.View.extend({ +instance.web_gantt.GanttView = instance.web.View.extend({ display_name: _lt('Gantt'), template: "GanttView", view_type: "gantt", @@ -122,7 +122,7 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({ return memo === undefined || date > memo ? date : memo; }, undefined); var duration = (task_stop.getTime() - task_start.getTime()) / (1000 * 60 * 60); - var group_name = openerp.web.format_value(task.name, self.fields[group_bys[level]]); + var group_name = instance.web.format_value(task.name, self.fields[group_bys[level]]); if (level == 0) { var group = new GanttProjectInfo(_.uniqueId("gantt_project_"), group_name, task_start); _.each(task_infos, function(el) { @@ -138,16 +138,16 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({ } } else { var task_name = task.__name; - var task_start = openerp.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_start]); + var task_start = instance.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_start]); if (!task_start) return; var task_stop; if (self.fields_view.arch.attrs.date_stop) { - task_stop = openerp.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_stop]); + task_stop = instance.web.auto_str_to_date(task[self.fields_view.arch.attrs.date_stop]); if (!task_stop) return; } else { // we assume date_duration is defined - var tmp = openerp.web.format_value(task[self.fields_view.arch.attrs.date_delay], + var tmp = instance.web.format_value(task[self.fields_view.arch.attrs.date_delay], self.fields[self.fields_view.arch.attrs.date_delay]); if (!tmp) return; @@ -197,10 +197,10 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({ var end = start.clone().addMilliseconds(duration * 60 * 60 * 1000); var data = {}; data[self.fields_view.arch.attrs.date_start] = - openerp.web.auto_date_to_str(start, self.fields[self.fields_view.arch.attrs.date_start].type); + instance.web.auto_date_to_str(start, self.fields[self.fields_view.arch.attrs.date_start].type); if (self.fields_view.arch.attrs.date_stop) { data[self.fields_view.arch.attrs.date_stop] = - openerp.web.auto_date_to_str(end, self.fields[self.fields_view.arch.attrs.date_stop].type); + instance.web.auto_date_to_str(end, self.fields[self.fields_view.arch.attrs.date_stop].type); } else { // we assume date_duration is defined data[self.fields_view.arch.attrs.date_delay] = duration; } @@ -210,7 +210,7 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({ }, on_task_display: function(task) { var self = this; - var pop = new openerp.web.form.FormOpenPopup(self); + var pop = new instance.web.form.FormOpenPopup(self); pop.on_write_completed.add_last(function() { self.reload(); }); @@ -223,7 +223,7 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({ }, on_task_create: function() { var self = this; - var pop = new openerp.web.form.SelectCreatePopup(this); + var pop = new instance.web.form.SelectCreatePopup(this); pop.on_select_elements.add_last(function() { self.reload(); }); diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index a55d8f15fbf..7016b9d8d85 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -2,7 +2,7 @@ * OpenERP web_graph *---------------------------------------------------------*/ -openerp.web_graph = function (openerp) { +openerp.web_graph = function (instance) { var COLOR_PALETTE = [ '#cc99ff', '#ccccff', '#48D1CC', '#CFD784', '#8B7B8B', '#75507b', '#b0008c', '#ff0000', '#ff8e00', '#9000ff', '#0078ff', '#00ff00', @@ -12,10 +12,10 @@ var COLOR_PALETTE = [ '#ad7fa8', '#729fcf', '#8ae234', '#e9b96e', '#fce94f', '#f57900', '#cc0000', '#d400a8']; -var QWeb = openerp.web.qweb, - _lt = openerp.web._lt; -openerp.web.views.add('graph', 'openerp.web_graph.GraphView'); -openerp.web_graph.GraphView = openerp.web.View.extend({ +var QWeb = instance.web.qweb, + _lt = instance.web._lt; +instance.web.views.add('graph', 'instance.web_graph.GraphView'); +instance.web_graph.GraphView = instance.web.View.extend({ display_name: _lt('Graph'), view_type: "graph", diff --git a/addons/web_hello/static/openerp/base_hello.js b/addons/web_hello/static/openerp/base_hello.js index 91caf263196..a74b8ef8f2f 100644 --- a/addons/web_hello/static/openerp/base_hello.js +++ b/addons/web_hello/static/openerp/base_hello.js @@ -2,9 +2,9 @@ * OpenERP base_hello (Example module) *---------------------------------------------------------*/ -openerp.web_hello = function(openerp) { +openerp.web_hello = function(instance) { -openerp.web.SearchView = openerp.web.SearchView.extend({ +instance.web.SearchView = instance.web.SearchView.extend({ init:function() { this._super.apply(this,arguments); this.on_search.add(function(){console.log('hello');}); @@ -13,7 +13,7 @@ openerp.web.SearchView = openerp.web.SearchView.extend({ // here you may tweak globals object, if any, and play with on_* or do_* callbacks on them -openerp.web.Login = openerp.web.Login.extend({ +instance.web.Login = instance.web.Login.extend({ start: function() { console.log('Hello there'); this._super.apply(this,arguments); diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 1118c6388c8..d3ba0c74f5a 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -1,11 +1,11 @@ -openerp.web_kanban = function (openerp) { +openerp.web_kanban = function (instance) { -var _t = openerp.web._t, - _lt = openerp.web._lt; -var QWeb = openerp.web.qweb; -openerp.web.views.add('kanban', 'openerp.web_kanban.KanbanView'); +var _t = instance.web._t, + _lt = instance.web._lt; +var QWeb = instance.web.qweb; +instance.web.views.add('kanban', 'instance.web_kanban.KanbanView'); -openerp.web_kanban.KanbanView = openerp.web.View.extend({ +instance.web_kanban.KanbanView = instance.web.View.extend({ template: "KanbanView", display_name: _lt('Kanban'), default_nr_columns: 3, @@ -23,12 +23,12 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ records : {} }; this.groups = []; - this.form_dialog = new openerp.web.form.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start(); + this.form_dialog = new instance.web.form.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start(); this.form_dialog.on_form_dialog_saved.add_last(this.do_reload); this.aggregates = {}; this.group_operators = ['avg', 'max', 'min', 'sum', 'count']; this.qweb = new QWeb2.Engine(); - this.qweb.debug = openerp.connection.debug; + this.qweb.debug = instance.connection.debug; this.qweb.default_dict = _.clone(QWeb.default_dict); this.has_been_loaded = $.Deferred(); this.search_domain = this.search_context = this.search_group_by = null; @@ -57,7 +57,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ var child = this.fields_view.arch.children[i]; if (child.tag === "templates") { this.transform_qweb_template(child); - this.qweb.add_template(openerp.web.json_node_to_xml(child)); + this.qweb.add_template(instance.web.json_node_to_xml(child)); break; } else if (child.tag === 'field') { this.extract_aggregates(child); @@ -109,7 +109,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ node.children = [{ tag: 'img', attrs: { - src: openerp.connection.prefix + '/web/static/src/img/icons/' + node.attrs['data-icon'] + '.png', + src: instance.connection.prefix + '/web/static/src/img/icons/' + node.attrs['data-icon'] + '.png', width: '16', height: '16' } @@ -141,7 +141,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ this.search_group_by = group_by; $.when(this.has_been_loaded).then(function() { self.group_by = group_by.length ? group_by[0] : self.fields_view.arch.attrs.default_group_by; - self.datagroup = new openerp.web.DataGroup(self, self.dataset.model, domain, context, self.group_by ? [self.group_by] : []); + self.datagroup = new instance.web.DataGroup(self, self.dataset.model, domain, context, self.group_by ? [self.group_by] : []); self.datagroup.list(self.fields_keys, self.do_process_groups, self.do_process_dataset); }); }, @@ -154,10 +154,10 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ var remaining = groups.length - 1, groups_array = []; _.each(groups, function (group, index) { - var dataset = new openerp.web.DataSetSearch(self, self.dataset.model, group.context, group.domain); + var dataset = new instance.web.DataSetSearch(self, self.dataset.model, group.context, group.domain); dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).then(function(records) { self.dataset.ids.push.apply(self.dataset.ids, dataset.ids); - groups_array[index] = new openerp.web_kanban.KanbanGroup(self, records, group, dataset); + groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset); if (!remaining--) { self.dataset.index = self.dataset.size() ? 0 : null; def.pipe(self.do_add_groups(groups_array)); @@ -175,7 +175,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ var def = $.Deferred(); self.do_clear_groups(); self.dataset.read_slice(self.fields_keys.concat(['__last_update']), { 'limit': self.limit }).then(function(records) { - var kgroup = new openerp.web_kanban.KanbanGroup(self, records, null, self.dataset); + var kgroup = new instance.web_kanban.KanbanGroup(self, records, null, self.dataset); self.do_add_groups([kgroup]).then(function() { def.resolve(); }); @@ -293,7 +293,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ }, }); -openerp.web_kanban.KanbanGroup = openerp.web.OldWidget.extend({ +instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({ template: 'KanbanView.group_header', init: function (parent, records, group, dataset) { var self = this; @@ -315,7 +315,7 @@ openerp.web_kanban.KanbanGroup = openerp.web.OldWidget.extend({ var field = this.view.fields_view.fields[this.view.group_by]; if (field) { try { - this.title = openerp.web.format_value(group.value, field, false); + this.title = instance.web.format_value(group.value, field, false); } catch(e) {} } _.each(this.view.aggregates, function(value, key) { @@ -376,7 +376,7 @@ openerp.web_kanban.KanbanGroup = openerp.web.OldWidget.extend({ do_add_records: function(records) { var self = this; _.each(records, function(record) { - var rec = new openerp.web_kanban.KanbanRecord(self, record); + var rec = new instance.web_kanban.KanbanRecord(self, record); rec.insertBefore(self.$records.find('.oe_kanban_show_more')); self.records.push(rec); }); @@ -404,7 +404,7 @@ openerp.web_kanban.KanbanGroup = openerp.web.OldWidget.extend({ } }); -openerp.web_kanban.KanbanRecord = openerp.web.OldWidget.extend({ +instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ template: 'KanbanView.record', init: function (parent, record) { this._super(parent); @@ -434,11 +434,11 @@ openerp.web_kanban.KanbanRecord = openerp.web.OldWidget.extend({ _.each(record, function(value, name) { var r = _.clone(self.view.fields_view.fields[name] || {}); if ((r.type === 'date' || r.type === 'datetime') && value) { - r.raw_value = openerp.web.auto_str_to_date(value); + r.raw_value = instance.web.auto_str_to_date(value); } else { r.raw_value = value; } - r.value = openerp.web.format_value(value, r); + r.value = instance.web.format_value(value, r); new_record[name] = r; }); return new_record; @@ -584,9 +584,9 @@ openerp.web_kanban.KanbanRecord = openerp.web.OldWidget.extend({ }, kanban_image: function(model, field, id) { id = id || ''; - var url = openerp.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id; + var url = instance.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id; if (this.record.__last_update && this.record.__last_update.raw_value) { - var time = openerp.web.str_to_datetime(this.record.__last_update.raw_value).getTime(); + var time = instance.web.str_to_datetime(this.record.__last_update.raw_value).getTime(); url += '&t=' + time; } return url; diff --git a/addons/web_mobile/static/src/js/chrome_mobile.js b/addons/web_mobile/static/src/js/chrome_mobile.js index a28956a0cab..a507e3b5943 100644 --- a/addons/web_mobile/static/src/js/chrome_mobile.js +++ b/addons/web_mobile/static/src/js/chrome_mobile.js @@ -2,36 +2,36 @@ * OpenERP Web Mobile chrome *---------------------------------------------------------*/ -openerp.web_mobile.chrome_mobile = function(openerp) { +openerp.web_mobile.chrome_mobile = function(instance) { -openerp.web_mobile.mobilewebclient = function(element_id) { - // TODO Helper to start mobile webclient rename it openerp.web.webclient - var client = new openerp.web_mobile.MobileWebClient(element_id); +instance.web_mobile.mobilewebclient = function(element_id) { + // TODO Helper to start mobile webclient rename it instance.web.webclient + var client = new instance.web_mobile.MobileWebClient(element_id); client.start(); return client; }; -openerp.web_mobile.MobileWebClient = openerp.web.OldWidget.extend({ +instance.web_mobile.MobileWebClient = instance.web.OldWidget.extend({ template: "WebClient", init: function(element_id) { this._super(null, element_id); - this.crashmanager = new openerp.web.CrashManager(this); - this.login = new openerp.web_mobile.Login(this, "oe_login"); + this.crashmanager = new instance.web.CrashManager(this); + this.login = new instance.web_mobile.Login(this, "oe_login"); }, start: function() { this._super.apply(this, arguments); var self = this; this.session.bind_session().then(function() { - openerp.web.qweb.add_template("xml/web_mobile.xml"); + instance.web.qweb.add_template("xml/web_mobile.xml"); self.$element.html(self.render()); self.login.start(); }); } }); -openerp.web_mobile.Login = openerp.web.OldWidget.extend({ +instance.web_mobile.Login = instance.web.OldWidget.extend({ template: "Login", @@ -103,7 +103,7 @@ openerp.web_mobile.Login = openerp.web.OldWidget.extend({ .addClass("login_valid"); //.hide(); if(!$('#oe_menu').html().length){ - this.menu = new openerp.web_mobile.Menu(this, "oe_menu", "oe_secondary_menu"); + this.menu = new instance.web_mobile.Menu(this, "oe_menu", "oe_secondary_menu"); this.menu.start(); }else{ $.mobile.changePage("#oe_menu", "slide", false, true); @@ -119,7 +119,7 @@ openerp.web_mobile.Login = openerp.web.OldWidget.extend({ } }); -openerp.web_mobile.Header = openerp.web.OldWidget.extend({ +instance.web_mobile.Header = instance.web.OldWidget.extend({ template: "Header", @@ -131,7 +131,7 @@ openerp.web_mobile.Header = openerp.web.OldWidget.extend({ } }); -openerp.web_mobile.Footer = openerp.web.OldWidget.extend({ +instance.web_mobile.Footer = instance.web.OldWidget.extend({ template: "Footer", @@ -143,7 +143,7 @@ openerp.web_mobile.Footer = openerp.web.OldWidget.extend({ } }); -openerp.web_mobile.Shortcuts = openerp.web.OldWidget.extend({ +instance.web_mobile.Shortcuts = instance.web.OldWidget.extend({ template: "Shortcuts", @@ -171,7 +171,7 @@ openerp.web_mobile.Shortcuts = openerp.web.OldWidget.extend({ res_id = $shortcut.data('res'); if(!$('[id^="oe_list_'+res_id+'"]').html()){ $('
').appendTo('#moe'); - this.listview = new openerp.web_mobile.ListView(self, "oe_list_"+res_id, res_id); + this.listview = new instance.web_mobile.ListView(self, "oe_list_"+res_id, res_id); this.listview.start(); }else{ $.mobile.changePage('#oe_list_'+res_id, "slide", false, true); @@ -182,7 +182,7 @@ openerp.web_mobile.Shortcuts = openerp.web.OldWidget.extend({ } }); -openerp.web_mobile.Menu = openerp.web.OldWidget.extend({ +instance.web_mobile.Menu = instance.web.OldWidget.extend({ template: "Menu", @@ -199,16 +199,16 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({ on_loaded: function(data) { var self = this; this.data = data; - this.header = new openerp.web_mobile.Header(this, "oe_header"); + this.header = new instance.web_mobile.Header(this, "oe_header"); this.header.start(); - this.footer = new openerp.web_mobile.Footer(this, "oe_footer"); + this.footer = new instance.web_mobile.Footer(this, "oe_footer"); this.footer.start(); this.$element.html(this.render(this.data)); this.$element.find("[data-role=header]").find('h1').html('Applications'); this.$element.find("[data-role=header]").find('#home').hide(); this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){ if(!$('#oe_shortcuts').html().length){ - this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts"); + this.shortcuts = new instance.web_mobile.Shortcuts(self, "oe_shortcuts"); this.shortcuts.start(); }else{ $.mobile.changePage($("#oe_shortcuts"), "slide", false, true); @@ -216,7 +216,7 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({ }); this.$element.find("[data-role=footer]").find('#preference').click(function(){ if(!$('#oe_options').html().length){ - this.options = new openerp.web_mobile.Options(self, "oe_options"); + this.options = new instance.web_mobile.Options(self, "oe_options"); this.options.start(); }else{ $.mobile.changePage("#oe_options", "slide", false, true); @@ -240,7 +240,7 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({ .addClass("secondary_menu"); if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ $('
').appendTo('#moe'); - this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children); + this.secondary = new instance.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children); this.secondary.start(); }else{ $.mobile.changePage('#oe_sec_menu_'+id, "slide", false, true); @@ -248,7 +248,7 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({ } }); -openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({ +instance.web_mobile.Secondary = instance.web.OldWidget.extend({ template: "Menu.secondary", @@ -287,7 +287,7 @@ openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({ .addClass("secondary_menu"); if(!$('[id^="oe_sec_menu_'+id+'"]').html()){ $('
').appendTo('#moe'); - this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children); + this.secondary = new instance.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children); this.secondary.start(); }else{ $.mobile.changePage('#oe_sec_menu_'+id, "slide", false, true); @@ -295,7 +295,7 @@ openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({ }else { if(!$('[id^="oe_list_'+id+'"]').html()){ $('
').appendTo('#moe'); - this.listview = new openerp.web_mobile.ListView(this, "oe_list_"+id, id); + this.listview = new instance.web_mobile.ListView(this, "oe_list_"+id, id); this.listview.start(); }else{ $.mobile.changePage('#oe_list_'+id, "slide", false, true); @@ -305,7 +305,7 @@ openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({ } }); -openerp.web_mobile.Options = openerp.web.OldWidget.extend({ +instance.web_mobile.Options = instance.web.OldWidget.extend({ template: "Options", diff --git a/addons/web_mobile/static/src/js/form_mobile.js b/addons/web_mobile/static/src/js/form_mobile.js index cf44cca1879..c3c2025ac1f 100644 --- a/addons/web_mobile/static/src/js/form_mobile.js +++ b/addons/web_mobile/static/src/js/form_mobile.js @@ -2,9 +2,9 @@ * OpenERP Web Mobile Form View *---------------------------------------------------------*/ -openerp.web_mobile.form_mobile = function (openerp) { +openerp.web_mobile.form_mobile = function (instance) { -openerp.web_mobile.FormView = openerp.web.OldWidget.extend({ +instance.web_mobile.FormView = instance.web.OldWidget.extend({ template: 'FormView', @@ -25,8 +25,8 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({ }else{ var view_id = this.viewid; } - this.dataset = new openerp.web.DataSetSearch(this, model, null, null); - var context = new openerp.web.CompoundContext(this.dataset.get_context()); + this.dataset = new instance.web.DataSetSearch(this, model, null, null); + var context = new instance.web.CompoundContext(this.dataset.get_context()); this.dataset.read_slice([]).then(function (result) { for (var i = 0; i < result.length; i++) { if (result[i].id == id) { @@ -71,14 +71,14 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({ var head = rel_field.string; if (rel_ids) { var list_ids = []; - var datasearch = new openerp.web.DataSetSearch(self, rel_field.relation, rel_field.context); + var datasearch = new instance.web.DataSetSearch(self, rel_field.relation, rel_field.context); datasearch.domain=[['id', 'in', rel_ids]]; datasearch.read_slice(['name'], {context:rel_field.context, domain: datasearch.domain, limit:80}).then(function(listrec){ _.each(listrec, function(i) { list_ids.push(i.id); }); _.extend(rel_field.context,{"html_name_get" : true}); - var dataset = new openerp.web.DataSet(self, rel_field.relation,rel_field.context); + var dataset = new instance.web.DataSet(self, rel_field.relation,rel_field.context); dataset.name_get(list_ids,function(res){ var additional = ""; if(res['html_name_get']){ @@ -86,7 +86,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({ } if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){ $('
').appendTo('#moe'); - $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res,'data': additional})); + $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(instance.web.qweb.render("ListView", {'records' : res,'data': additional})); $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('h1').html(head); $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('#home').click(function(){ $.mobile.changePage("#oe_menu", "slide", false, true); @@ -98,7 +98,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({ var listid = $(ev.currentTarget).data('id'); if(!$('[id^="oe_form_'+listid+rel_field.relation+'"]').html()){ $('
').appendTo('#moe'); - this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+listid+rel_field.relation, listid, '', head, rel_field.relation, false); + this.formview = new instance.web_mobile.FormView(self, "oe_form_"+listid+rel_field.relation, listid, '', head, rel_field.relation, false); this.formview.start(); }else{ $.mobile.changePage('#oe_form_'+listid+rel_field.relation, "slide", false, true); @@ -126,7 +126,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({ if(selected_id){ if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){ $('
').appendTo('#moe'); - this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false); + this.formview = new instance.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false); this.formview.start(); }else{ $.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true); @@ -168,7 +168,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({ // Temp: Set as disabled $("#"+getfields[i].attrs.name).attr('disabled', 'true'); if(result.fields[getfields[i].attrs.name]){ - var dateresult = openerp.web.format_value(data[getfields[i].attrs.name], {"widget": result.fields[getfields[i].attrs.name].type}); + var dateresult = instance.web.format_value(data[getfields[i].attrs.name], {"widget": result.fields[getfields[i].attrs.name].type}); $(this).val(dateresult); } } diff --git a/addons/web_mobile/static/src/js/list_mobile.js b/addons/web_mobile/static/src/js/list_mobile.js index 16296df59e7..abe5620a0a3 100644 --- a/addons/web_mobile/static/src/js/list_mobile.js +++ b/addons/web_mobile/static/src/js/list_mobile.js @@ -2,9 +2,9 @@ * OpenERP Web Mobile List View *---------------------------------------------------------*/ -openerp.web_mobile.list_mobile = function (openerp) { +openerp.web_mobile.list_mobile = function (instance) { -openerp.web_mobile.ListView = openerp.web.OldWidget.extend({ +instance.web_mobile.ListView = instance.web.OldWidget.extend({ template: 'ListView', @@ -31,14 +31,14 @@ openerp.web_mobile.ListView = openerp.web.OldWidget.extend({ on_search_data: function(ev){ var self = this; var list_ids = []; - var datasearch = new openerp.web.DataSetSearch(self, self.action.res_model,self.action.context); + var datasearch = new instance.web.DataSetSearch(self, self.action.res_model,self.action.context); datasearch.domain = self.action.domain; datasearch.read_slice(['name'], {context:datasearch.context, domain: datasearch.domain, limit:80}).then(function(listresult){ _.each(listresult, function(i) { list_ids.push(i.id); }); _.extend(self.action.context,{"html_name_get" : true}); - var dataset = new openerp.web.DataSet(self, datasearch.model,datasearch.context); + var dataset = new instance.web.DataSet(self, datasearch.model,datasearch.context); dataset.name_get(list_ids,function(res){ var additional = ""; if(res['html_name_get']){ @@ -64,7 +64,7 @@ openerp.web_mobile.ListView = openerp.web.OldWidget.extend({ head_title = $.trim($record.text()); if(!$('[id^="oe_form_'+id+this.action.res_model+'"]').html()){ $('
').appendTo('#moe'); - this.formview = new openerp.web_mobile.FormView(this, "oe_form_"+id+this.action.res_model, id, this.action, head_title, '' ,''); + this.formview = new instance.web_mobile.FormView(this, "oe_form_"+id+this.action.res_model, id, this.action, head_title, '' ,''); this.formview.start(); }else{ $.mobile.changePage('#oe_form_'+id+this.action.res_model, "slide", false, true); diff --git a/addons/web_process/static/src/js/process.js b/addons/web_process/static/src/js/process.js index 4a731b9d3f6..85bb3447b71 100644 --- a/addons/web_process/static/src/js/process.js +++ b/addons/web_process/static/src/js/process.js @@ -1,7 +1,7 @@ -openerp.web_process = function (openerp) { - var QWeb = openerp.web.qweb, - _t = openerp.web._t; - openerp.web.ViewManager.include({ +openerp.web_process = function (instance) { + var QWeb = instance.web.qweb, + _t = instance.web._t; + instance.web.ViewManager.include({ start: function() { this._super(); this.process_check(); @@ -15,7 +15,7 @@ openerp.web_process = function (openerp) { grandparent = this.getParent() && this.getParent().getParent(), view = this.views[this.views_src[0].view_type], $process_view = this.$element.find('.oe-process-view'); - if (!(grandparent instanceof openerp.web.WebClient) || + if (!(grandparent instanceof instance.web.WebClient) || !(view.view_type === this.views_src[0].view_type && view.view_id === this.views_src[0].view_id)) { $process_view.hide(); @@ -86,7 +86,7 @@ openerp.web_process = function (openerp) { if(!this.subflow_model) { def.resolve(this.action ? (this.action.help!=false ? this.action.help : 'Help: Not Defined') : 'Help: Not Defined'); } else { - var dataset = new openerp.web.DataSetSearch(this, "ir.actions.act_window", this.session.context, []); + var dataset = new instance.web.DataSetSearch(this, "ir.actions.act_window", this.session.context, []); dataset .read_slice(['help'], { @@ -107,7 +107,7 @@ openerp.web_process = function (openerp) { if(this.process_id) return def.resolve().promise(); - this.process_dataset = new openerp.web.DataSetStatic(this, "process.process", this.session.context); + this.process_dataset = new instance.web.DataSetStatic(this, "process.process", this.session.context); this.process_dataset .call("search_by_model", [self.process_model,self.session.context]) .done(function(res) { @@ -237,7 +237,7 @@ openerp.web_process = function (openerp) { }, jump_to_view: function(model, id) { var self = this; - var dataset = new openerp.web.DataSetStatic(this, 'ir.values', this.session.context); + var dataset = new instance.web.DataSetStatic(this, 'ir.values', this.session.context); dataset.call('get', ['action', 'tree_but_open',[['ir.ui.menu', id]], dataset.context], function(res) { @@ -246,7 +246,7 @@ openerp.web_process = function (openerp) { action_id: action.id, context: dataset.context }, function(result) { - var action_manager = new openerp.web.ActionManager(self); + var action_manager = new instance.web.ActionManager(self); action_manager.replace(self.$element); action_manager.do_action(result.result); }); @@ -254,8 +254,8 @@ openerp.web_process = function (openerp) { }, edit_process_view: function() { var self = this; - var action_manager = new openerp.web.ActionManager(this); - var dialog = new openerp.web.Dialog(this, { + var action_manager = new instance.web.ActionManager(this); + var dialog = new instance.web.Dialog(this, { width: 800, buttons : [ {text: _t("Cancel"), click: function() { $(this).dialog('destroy'); }}, diff --git a/addons/web_tests/static/src/js/web_tests.js b/addons/web_tests/static/src/js/web_tests.js index f98dd95f66f..e6e6079ede5 100644 --- a/addons/web_tests/static/src/js/web_tests.js +++ b/addons/web_tests/static/src/js/web_tests.js @@ -1,16 +1,16 @@ -openerp.web_tests = function (db) { - db.web.client_actions.add( +openerp.web_tests = function (instance) { + instance.web.client_actions.add( 'buncha-forms', 'instance.web_tests.BunchaForms'); - db.web_tests = {}; - db.web_tests.BunchaForms = db.web.OldWidget.extend({ + instance.web_tests = {}; + instance.web_tests.BunchaForms = instance.web.OldWidget.extend({ init: function (parent) { this._super(parent); - this.dataset = new db.web.DataSetSearch(this, 'test.listview.relations'); - this.form = new db.web.FormView(this, this.dataset, false, { + this.dataset = new instance.web.DataSetSearch(this, 'test.listview.relations'); + this.form = new instance.web.FormView(this, this.dataset, false, { action_buttons: false, pager: false }); - this.form.registry = db.web.form.readonly; + this.form.registry = instance.web.form.readonly; }, render: function () { return '
';