diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index a67d9b72d2c..16861a7853f 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -646,7 +646,6 @@ .openerp .oe_dropdown_toggle { color: #404040; font-weight: normal; - display:inline-block; } .openerp .oe_dropdown_hover:hover .oe_dropdown_menu, .openerp .oe_dropdown_menu.oe_opened { display: block; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 3661fedd49f..e3cb661d580 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -540,7 +540,6 @@ $sheet-max-width: 860px .oe_dropdown_toggle color: #404040 font-weight: normal - display:inline-block .oe_dropdown_hover:hover .oe_dropdown_menu, .oe_dropdown_menu.oe_opened display: block .oe_dropdown_menu diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 3114aaf315f..9fdfb50307f 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -79,6 +79,9 @@ instance.web.Dialog = instance.web.Widget.extend({ } } if (options) { + if (options.buttons) { + this.params_buttons = true; + } _.extend(this.dialog_options, options); } }, @@ -123,7 +126,13 @@ instance.web.Dialog = instance.web.Widget.extend({ if (! this.dialog_inited) this.init_dialog(); var o = this.get_options(options); + if (! this.params_buttons) { + this.$buttons.appendTo($("body")); + } instance.web.dialog(this.$el, o).dialog('open'); + if (! this.params_buttons) { + this.$buttons.appendTo(this.$el.dialog("widget")); + } if (o.height === 'auto' && o.max_height) { this.$el.css({ 'max-height': o.max_height, 'overflow-y': 'auto' }); } @@ -133,6 +142,10 @@ instance.web.Dialog = instance.web.Widget.extend({ this.renderElement(); var o = this.get_options(options); instance.web.dialog(this.$el, o); + if (! this.params_buttons) { + this.$buttons = $('
'); + this.$el.dialog("widget").append(this.$buttons); + } var res = this.start(); this.dialog_inited = true; return res; diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 5f0ecc80827..ea160d6faee 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.pipe(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 cee8c56480f..c188abc853e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -159,10 +159,11 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.has_been_loaded.resolve(); // Add bounce effect on button 'Edit' when click on readonly page view. - this.$el.find(".oe_form_field,label").on('click', function (e) { + this.$el.find(".oe_form_group_row,.oe_form_field,label").on('click', function (e) { if(self.get("actual_mode") == "view") { var $button = self.options.$buttons.find(".oe_form_button_edit"); $button.effect('bounce', {distance: 18, times: 5}, 150) + e.stopPropagation(); } }); @@ -420,10 +421,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.do_update_pager(); }, do_update_pager: function(hide_index) { - var index = hide_index ? '-' : this.dataset.index + 1; - this.$pager.find('button').prop('disabled', this.dataset.ids.length < 2).end() - .find('span.oe_pager_index').html(index).end() - .find('span.oe_pager_count').html(this.dataset.ids.length); + this.$pager.find('button').prop('disabled', this.dataset.ids.length < 2); + if (hide_index || this.dataset.ids.length <= 1) { + $(".oe_form_pager_state", this.$pager).html(""); + } else { + $(".oe_form_pager_state", this.$pager).html(_.str.sprintf(_t("%d / %d"), this.dataset.index + 1, this.dataset.ids.length)); + } }, parse_on_change: function (on_change, widget) { var self = this; @@ -2613,6 +2616,7 @@ instance.web.form.CompletionFieldMixin = { var dataset = new instance.web.DataSet(this, this.field.relation, self.build_context()); var blacklist = this.get_search_blacklist(); + this.last_query = search_val; return this.orderer.add(dataset.name_search( search_val, new instance.web.CompoundDomain(self.build_domain(), [["id", "not in", blacklist]]), @@ -2720,6 +2724,32 @@ instance.web.form.CompletionFieldMixin = { }, }; +instance.web.form.M2ODialog = instance.web.Dialog.extend({ + template: "M2ODialog", + init: function(parent) { + this._super(parent, { + title: _.str.sprintf(_t("Add %s"), parent.string), + width: 312, + }); + }, + start: function() { + var self = this; + this.$buttons.html(QWeb.render("M2ODialog.buttons")); + this.$("input").val(this.getParent().last_query); + this.$buttons.find(".oe_form_m2o_qc_button").click(function(){ + self.getParent()._quick_create(self.$("input").val()); + self.destroy(); + }); + this.$buttons.find(".oe_form_m2o_sc_button").click(function(){ + self.getParent()._search_create_popup("form", undefined, self.getParent()._create_context(self.$("input").val())); + self.destroy(); + }); + this.$buttons.find(".oe_form_m2o_cancel_button").click(function(){ + self.destroy(); + }); + }, +}); + instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, { template: "FieldMany2One", init: function(field_manager, node) { @@ -2750,26 +2780,23 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc this.render_editable(); this.render_value(); }, + init_error_displayer: function() { + // nothing + }, + hide_error_displayer: function() { + // doesn't work + }, + show_error_displayer: function() { + new instance.web.form.M2ODialog(this).open(); + }, render_editable: function() { var self = this; this.$input = this.$el.find("input"); - self.$input.tipsy({ - title: function() { - return QWeb.render('Tipsy.alert', { - message: "No element was selected, you should create or select one from the dropdown list." - }); - }, - trigger:'manual', - fade: true, - gravity: 's', - html: true, - opacity: 1, - offset: 4, - }); + this.init_error_displayer(); self.$input.on('focus', function() { - self.$input.tipsy("hide"); + self.hide_error_displayer(); }); this.$drop_down = this.$el.find(".oe_m2o_drop_down_button"); @@ -2823,10 +2850,10 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc } } }); - self.tip_def = $.Deferred(); - self.untip_def = $.Deferred(); - var tip_delay = 200; - var tip_duration = 15000; + self.ed_def = $.Deferred(); + self.uned_def = $.Deferred(); + var ed_delay = 200; + var ed_duration = 15000; var anyoneLoosesFocus = function() { var used = false; if (self.floating) { @@ -2846,25 +2873,25 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc } self.floating = false; } - if (used && self.get("value") === false && ! self.no_tipsy) { - self.tip_def.reject(); - self.untip_def.reject(); - self.tip_def = $.Deferred(); - self.tip_def.then(function() { - self.$input.tipsy("show"); + if (used && self.get("value") === false && ! self.no_ed) { + self.ed_def.reject(); + self.uned_def.reject(); + self.ed_def = $.Deferred(); + self.ed_def.then(function() { + self.show_error_displayer(); }); setTimeout(function() { - self.tip_def.resolve(); - self.untip_def.reject(); - self.untip_def = $.Deferred(); - self.untip_def.then(function() { - self.$input.tipsy("hide"); + self.ed_def.resolve(); + self.uned_def.reject(); + self.uned_def = $.Deferred(); + self.uned_def.then(function() { + self.hide_error_displayer(); }); - setTimeout(function() {self.untip_def.resolve();}, tip_duration); - }, tip_delay); + setTimeout(function() {self.uned_def.resolve();}, ed_duration); + }, ed_delay); } else { - self.no_tipsy = false; - self.tip_def.reject(); + self.no_ed = false; + self.ed_def.reject(); } }; var ignore_blur = false; @@ -3004,13 +3031,13 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc this.$input.focus(); }, _quick_create: function() { - this.no_tipsy = true; - this.tip_def.reject(); + this.no_ed = true; + this.ed_def.reject(); return instance.web.form.CompletionFieldMixin._quick_create.apply(this, arguments); }, _search_create_popup: function() { - this.no_tipsy = true; - this.tip_def.reject(); + this.no_ed = true; + this.ed_def.reject(); return instance.web.form.CompletionFieldMixin._search_create_popup.apply(this, arguments); }, }); @@ -4790,7 +4817,6 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ } this.render_elements(); } - console.log('end selection'); }, /** Renders the widget. This function also checks for statusbar_colors='{"pending": "blue"}' * attribute in the widget. This allows to set a given color to a given diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 015cd1636f1..0bee5cad755 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -830,6 +830,10 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.$el.prepend( $('
').html(this.options.action.help) ); + var create_nocontent = this.$buttons; + this.$el.find('.oe_view_nocontent').click(function() { + create_nocontent.effect('bounce', {distance: 18, times: 5}, 150); + }); } }); instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.ListView.List# */{ @@ -919,8 +923,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. this.records.bind(event, callback); }, this); - this.$_element = $('') - .appendTo(document.body) + this.$current = $('') .delegate('th.oe_list_record_selector', 'click', function (e) { e.stopPropagation(); var selection = self.get_selection(); @@ -1011,11 +1014,6 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. }); }, render: function () { - var self = this; - if (this.$current) { - this.$current.remove(); - } - this.$current = this.$_element.clone(true); this.$current.empty().append( QWeb.render('ListView.rows', _.extend({ render_cell: function () { @@ -1051,7 +1049,11 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. var row = cells.join(''); this.$current .children('tr:not([data-id])').remove().end() - .append(new Array(count - this.records.length + 1).join(row)); + .append(new Array(count - this.records.length + 1).join(row)).click( + function() { + $('button.oe_list_add').effect('bounce', {distance: 18, times: 5}, 150); + } + ); }, /** * Gets the ids of all currently selected records, if any @@ -1091,7 +1093,6 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. if (!this.$current) { return; } this.$current.remove(); this.$current = null; - this.$_element.remove(); }, get_records: function () { return this.records.map(function (record) { diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 02297e9db01..608a856785e 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -327,7 +327,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ } this.dialog_stop(); }, - ir_actions_server: function (action, on_closed) { + ir_actions_server: function (action, on_closed, clear_breadcrumbs) { var self = this; this.rpc('/web/action/run', { action_id: action.id, diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index b6b89a4f1ec..232d4b618d7 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -650,9 +650,11 @@
- +
+ +
@@ -693,7 +695,7 @@ - + @@ -740,7 +742,7 @@
- 0 / 0 +
@@ -917,6 +919,7 @@ t-att-tabindex="widget.node.attrs.tabindex" t-att-autofocus="widget.node.attrs.autofocus" t-att-placeholder="widget.node.attrs.placeholder" + t-att-maxlength="widget.field.size" />
@@ -931,6 +934,7 @@ t-att-tabindex="widget.node.attrs.tabindex" t-att-autofocus="widget.node.attrs.autofocus" t-att-placeholder="widget.node.attrs.placeholder" + t-att-maxlength="widget.field.size" />
@@ -949,6 +953,7 @@ t-att-tabindex="widget.node.attrs.tabindex" t-att-autofocus="widget.node.attrs.autofocus" t-att-placeholder="! widget.get('effective_readonly') ? widget.node.attrs.placeholder : ''" + t-att-maxlength="widget.field.size" >Save - + or @@ -1698,4 +1703,14 @@
+ +
+ Name: +
+
+ + + + + diff --git a/addons/web_graph/controllers/graph.py b/addons/web_graph/controllers/graph.py index f6c1343c042..e5c15898155 100644 --- a/addons/web_graph/controllers/graph.py +++ b/addons/web_graph/controllers/graph.py @@ -52,6 +52,9 @@ class GraphView(View): def _convert(field, data, tick=True): if fields[field]['type']=='many2one': data = data and data[1] + elif (fields[field]['type']=='selection') and (type(fields[field]['selection']) in (list, tuple)): + d = dict(fields[field]['selection']) + data = d[data] if tick: return ticks.setdefault(data, len(ticks)) return data or 0 diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index b3fef54d094..b82b1521e87 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -142,9 +142,11 @@ instance.web_graph.GraphView = instance.web.View.extend({ options_bar: function (data) { var min = _(data.data).chain() .map(function (record) { - return _.min(record.data, function (item) { - return item[1]; - })[1]; + if (record.data.length > 0){ + return _.min(record.data, function (item) { + return item[1]; + })[1]; + } }).min().value(); return { bars : { diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index e632cb3298f..48cf725ead3 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -141,7 +141,6 @@ margin-left: 4px; cursor: pointer; position: relative; - display: inline-block; top: -8px; } .openerp .oe_kanban_view .oe_kanban_add { diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index 295bb4099c6..95a63dbd1a2 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -153,7 +153,6 @@ margin-left: 4px cursor: pointer position: relative - display: inline-block top: -8px .oe_kanban_add float: right diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 6d68e62899a..d5389c6fa0b 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -396,8 +396,6 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } else { this.$el.find('.oe_kanban_draghandle').removeClass('oe_kanban_draghandle'); } - - this.transform_widget_many2many(); }, on_record_moved : function(record, old_group, old_index, new_group, new_index) { var self = this; @@ -414,7 +412,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ var data = {}; data[this.group_by] = new_group.value; this.dataset.write(record.id, data, {}, function() { - //self.do_reload(); + record.do_reload(); new_group.do_save_sequences(); }).fail(function(error, evt) { evt.preventDefault(); @@ -475,6 +473,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this.$el.prepend( $('
').html(this.options.action.help) ); + var create_nocontent = this.$buttons; + this.$el.find('.oe_view_nocontent').click(function() { + create_nocontent.effect('bounce', {distance: 18, times: 5}, 150); + }); } }); @@ -809,7 +811,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ } }); - if (this.$el.find('.oe_kanban_global_click,.oe_kanban_global_click_edit').length) { + if (this.$el.find('.oe_kanban_global_click').length) { this.$el.on('click', function(ev) { if (!ev.isTrigger && !$(ev.target).data('events')) { var trigger = true; @@ -850,15 +852,8 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({ }); } }, - /* actions when user click on the block with a specific class - * open on normal view : oe_kanban_global_click - * open on form/edit view : oe_kanban_global_click_edit - */ on_card_clicked: function(ev) { - if(this.$el.find('.oe_kanban_global_click_edit').size()>0) - this.do_action_edit(); - else - this.do_action_open(); + this.view.open_record(this.id); }, setup_color_picker: function() { var self = this;