diff options
| author | Olivier Dony <odo@openerp.com> | 2012-09-14 17:37:18 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2012-09-14 17:37:18 +0200 |
| commit | a7b1c0ff55959013e87ca4737ada13aba960e8cd (patch) | |
| tree | f50cfc7ad763ddc64930f447691f09883f7200e6 /addons/web/static/src/js | |
| parent | aa98dd38e2f8ce9a3e5a26f391fd1fb59e89a0e6 (diff) | |
| parent | 8a6b7b7ed489ddfa5b7dd9d9d0206115259dbcb6 (diff) | |
[MERGE] Sync with trunk
bzr revid: odo@openerp.com-20120914153718-jk432ri8sz38z2bt
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 40 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 33 | ||||
| -rw-r--r-- | addons/web/static/src/js/views.js | 24 |
3 files changed, 57 insertions, 40 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 5f0ecc80827..295976eb639 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -156,30 +156,32 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess var to_load = _.difference(result, self.module_list).join(','); self.module_list = all_modules; - var loaded = $.Deferred().resolve().promise(); - if (to_load.length) { + var loaded = self.rpc('/web/webclient/translations', params).then(function(trans) { + instance.web._t.database.set_bundle(trans); + }); + var file_list = ["/web/static/lib/datejs/globalization/" + lang.replace("_", "-") + ".js"]; + if(to_load.length) { loaded = $.when( - self.rpc('/web/webclient/csslist', {mods: to_load}, self.do_load_css), + loaded, + self.rpc('/web/webclient/csslist', {mods: to_load}).then(self.do_load_css), self.rpc('/web/webclient/qweblist', {mods: to_load}).pipe(self.do_load_qweb), - self.rpc('/web/webclient/translations', params).pipe(function(trans) { - instance.web._t.database.set_bundle(trans); - var file_list = ["/web/static/lib/datejs/globalization/" + lang.replace("_", "-") + ".js"]; - return self.rpc('/web/webclient/jslist', {mods: to_load}).pipe(function(files) { - return self.do_load_js(file_list.concat(files)); - }).then(function () { - if (!Date.CultureInfo.pmDesignator) { - // If no am/pm designator is specified but the openerp - // datetime format uses %i, date.js won't be able to - // correctly format a date. See bug#938497. - Date.CultureInfo.amDesignator = 'AM'; - Date.CultureInfo.pmDesignator = 'PM'; - } - }); - })) + self.rpc('/web/webclient/jslist', {mods: to_load}).then(function(files) { + file_list = file_list.concat(files); + }) + ); } - return loaded.then(function() { + return loaded.then(function () { + return self.do_load_js(file_list); + }).then(function() { self.on_modules_loaded(); self.trigger('module_loaded'); + if (!Date.CultureInfo.pmDesignator) { + // If no am/pm designator is specified but the openerp + // datetime format uses %i, date.js won't be able to + // correctly format a date. See bug#938497. + Date.CultureInfo.amDesignator = 'AM'; + Date.CultureInfo.pmDesignator = 'PM'; + } }); }); }, diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 08c9b96660e..7d328f012fe 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -321,7 +321,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } this.datarecord = record; this._actualize_mode(); - this.set({ 'title' : record.id ? record.display_name : "New record" }); + this.set({ 'title' : record.id ? record.display_name : "New" }); if (this.qweb) { this.kill_current_form(); @@ -1399,6 +1399,10 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt if (! page.__ic) return; page.__ic.on("change:effective_invisible", null, function() { + if (!page.__ic.get('effective_invisible')) { + $new_notebook.tabs('select', i); + return; + } var current = $new_notebook.tabs("option", "selected"); if (! pages[current].__ic || ! pages[current].__ic.get("effective_invisible")) return; @@ -2400,10 +2404,6 @@ instance.web.form.FieldTextHtml = instance.web.form.AbstractField.extend(instanc template: 'FieldTextHtml', init: function() { this._super.apply(this, arguments); - if (this.field.type !== 'html' && ! this.options.safe) { - throw new Error(_.str.sprintf( - _t("Error with field %s, it is not allowed to use the widget 'html' with any other field type than 'html'"), this.string)); - } }, initialize_content: function() { var self = this; @@ -2437,7 +2437,7 @@ instance.web.form.FieldTextHtml = instance.web.form.AbstractField.extend(instanc }, render_value: function() { if (! this.get("effective_readonly")) { - this.$textarea.val(this.get('value')); + this.$textarea.val(this.get('value') || ''); this._updating_editor = true; this.$cleditor.updateFrame(); this._updating_editor = false; @@ -2712,8 +2712,10 @@ instance.web.form.CompletionFieldMixin = { _create_context: function(name) { var tmp = {}; var field = (this.options || {}).create_name_field; - if (field !== false && (this.options || {}).quick_create !== false) - tmp["default_" + field] = name || "name"; + if (field === undefined) + field = "name"; + if (field !== false && name && (this.options || {}).quick_create !== false) + tmp["default_" + field] = name; return tmp; }, }; @@ -2773,7 +2775,8 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc this.$drop_down = this.$el.find(".oe_m2o_drop_down_button"); this.$follow_button = $(".oe_m2o_cm_button", this.$el); - this.$follow_button.click(function() { + this.$follow_button.click(function(ev) { + ev.preventDefault(); if (!self.get('value')) { self.focus(); return; @@ -2951,14 +2954,10 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc var lines = _.escape(str).split("\n"); var link = ""; var follow = ""; - if (! this.options.highlight_first_line) { - link = lines.join("<br />"); - } else { - link = lines[0]; - follow = _.rest(lines).join("<br />"); - if (follow) - link += "<br />"; - } + link = lines[0]; + follow = _.rest(lines).join("<br />"); + if (follow) + link += "<br />"; var $link = this.$el.find('.oe_form_uri') .unbind('click') .html(link); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 2dffe9520a1..02297e9db01 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -20,7 +20,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ }, start: function() { this._super.apply(this, arguments); - this.$el.on('click', '.oe_breadcrumb_item', this.on_breadcrumb_clicked); + this.$el.on('click', 'a.oe_breadcrumb_item', this.on_breadcrumb_clicked); }, dialog_stop: function () { if (this.dialog) { @@ -95,7 +95,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ break; } } - var subindex = $e.parent().find('.oe_breadcrumb_item[data-id=' + $e.data('id') + ']').index($e); + var subindex = $e.parent().find('a.oe_breadcrumb_item[data-id=' + $e.data('id') + ']').index($e); this.select_breadcrumb(index, subindex); }, select_breadcrumb: function(index, subindex) { @@ -148,7 +148,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ for (var j = 0; j < tit.length; j += 1) { var label = _.escape(tit[j]); if (i === this.breadcrumbs.length - 1 && j === tit.length - 1) { - titles.push(label); + titles.push(_.str.sprintf('<span class="oe_breadcrumb_item">%s</span>', label)); } else { titles.push(_.str.sprintf('<a href="#" class="oe_breadcrumb_item" data-id="%s">%s</a>', item.id, label)); } @@ -566,7 +566,8 @@ instance.web.ViewManager = instance.web.Widget.extend({ } return controller.get('title'); }); - if (next && next.action && next.action.res_id && self.active_view === 'form' && self.model === next.action.res_model && id === next.action.res_id) { + if (next && next.action && next.action.res_id && self.dataset && + self.active_view === 'form' && self.dataset.model === next.action.res_model && id === next.action.res_id) { // If the current active view is a formview and the next item in the breadcrumbs // is an action on same object (model / res_id), then we omit the current formview's title titles.pop(); @@ -836,6 +837,21 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ } }); break; + case 'print_workflow': + if (current_view.get_selected_ids && current_view.get_selected_ids().length == 1) { + instance.web.blockUI(); + var action = { + context: { active_ids: current_view.get_selected_ids() }, + report_name: "workflow.instance.graph", + datas: { + model: this.dataset.model, + id: current_view.get_selected_ids()[0], + nested: true, + } + }; + this.session.get_file({ url: '/web/report', data: {action: JSON.stringify(action)}, complete: instance.web.unblockUI }); + } + break; default: if (val) { console.log("No debug handler for ", val); |
