diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 16861a7853f..a1dfc1ec0b3 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -25,12 +25,16 @@ display: none !important; } } - .openerp.openerp_webclient_container { height: 100%; position: relative; } +.text-tag .text-button { + height: auto !important; + min-height: 16px; +} + .openerp { padding: 0; margin: 0; @@ -41,7 +45,7 @@ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); /* http://www.quirksmode.org/dom/inputfile.html * http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image - */ */ + */ } .openerp :-moz-placeholder { color: #afafb6 !important; @@ -532,6 +536,11 @@ .openerp .oe_tags.oe_inline { min-width: 250px; } +.openerp .oe_form header .oe_tags { + margin:5px 0 0 5px; + width:400px; + padding-bottom:0; +} .openerp .oe_tags .text-wrap { width: 100% !important; } @@ -655,7 +664,7 @@ position: absolute; top: 26px; left: 0; - z-index: 1; + z-index: 3; margin: 0; padding: 0; border: 1px solid #afafb6; @@ -1521,6 +1530,7 @@ font-size: 1px; letter-spacing: -1px; color: transparent; + font-weight: normal; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; @@ -1914,7 +1924,7 @@ } .openerp .oe_form_nosheet > header { margin: -16px -16px 0 -16px; - padding: 8px; + padding: 0; } .openerp .oe_form_sheetbg { padding: 8px 0; @@ -1957,6 +1967,9 @@ background-image: -o-linear-gradient(top, #fcfcfc, #dedede); background-image: linear-gradient(to bottom, #fcfcfc, #dedede); } +.openerp .oe_form header > span { + margin-left: 4px; +} .openerp .oe_form header ul { display: inline-block; float: right; @@ -2001,6 +2014,8 @@ .openerp .oe_form .oe_subtotal_footer .oe_subtotal_footer_separator { width: 108px; border-top: 1px solid #cacaca; + margin-top: 4px; + padding-top: 4px; font-weight: bold; font-size: 18px; } @@ -2214,6 +2229,9 @@ .openerp .oe_form_editable .oe_form .oe_form_field_datetime { width: 11.5em !important; } +.openerp .oe_hidden_input_file { + position: relative; +} .openerp .oe_hidden_input_file input.oe_form_binary_file { z-index: 0; line-height: 0; @@ -2479,6 +2497,7 @@ } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_float input, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_view_integer input { text-align: right; + width: 100%; } .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime > span, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date > span { width: 100%; @@ -2638,20 +2657,24 @@ } .openerp .oe_list_content td.oe_list_field_handle { width: 1em; + padding: 0 !important; cursor: ns-resize; } .openerp .oe_list_content td.oe_list_field_handle .oe_list_handle { font-size: 1px; letter-spacing: -1px; color: transparent; + font-weight: normal; + margin-right: 7px; } .openerp .oe_list_content td.oe_list_field_handle .oe_list_handle:before { - font: 21px "mnmliconsRegular"; - content: "ö"; - color: #404040; + font: 18px "entypoRegular"; + content: "}"; + color: #e0e0e0; } .openerp .oe_list_cannot_edit .oe_list_header_handle, .openerp .oe_list_cannot_edit .oe_list_field_handle { display: none !important; + padding: 0 !important; } .openerp .oe_list_cannot_delete .oe_list_record_delete { display: none !important; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e3cb661d580..8364f19646b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -119,11 +119,22 @@ $sheet-max-width: 860px font-size: 1px letter-spacing: -1px color: transparent + font-weight: normal &:before font: 21px "mnmliconsRegular" content: $icon-name color: $color +@mixin text-to-entypo-icon($icon-name, $color: #404040, $size: 21px) + font-size: 1px + letter-spacing: -1px + color: transparent + font-weight: normal + &:before + font: $size "entypoRegular" + content: $icon-name + color: $color + // }}} @media print @@ -134,6 +145,11 @@ $sheet-max-width: 860px height: 100% position: relative +// jQueryUI css bug fixing +.text-tag .text-button + height: auto !important + min-height: 16px + .openerp // Global style {{{ padding: 0 @@ -459,6 +475,12 @@ $sheet-max-width: 860px text-decoration: none margin-bottom: 1px // }}} + .oe_form + header + .oe_tags + margin:5px 0 0 5px + width:400px + padding-bottom:0 // Tooltips {{{ &.oe_tooltip font-size: 12px @@ -547,7 +569,7 @@ $sheet-max-width: 860px position: absolute top: 26px left: 0 - z-index: 1 + z-index: 3 margin: 0 padding: 0 border: 1px solid $tag-border @@ -1509,7 +1531,7 @@ $sheet-max-width: 860px margin: 16px > header margin: -16px -16px 0 -16px - padding: 8px + padding: 0 .oe_form_sheetbg padding: 8px 0 .oe_form_sheet_width @@ -1540,6 +1562,8 @@ $sheet-max-width: 860px border-bottom: 1px solid #cacaca padding-left: 2px @include vertical-gradient(#fcfcfc, #dedede) + > span + margin-left: 4px ul display: inline-block float: right @@ -1574,6 +1598,8 @@ $sheet-max-width: 860px .oe_subtotal_footer_separator width: 108px border-top: 1px solid #cacaca + margin-top: 4px + padding-top: 4px font-weight: bold font-size: 18px label:after @@ -1751,6 +1777,9 @@ $sheet-max-width: 860px * http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image */ .oe_hidden_input_file + // Position: relative is used for the hidden input[type=file] + // Do not remove it anymore ! + position: relative input.oe_form_binary_file z-index: 0 line-height: 0 @@ -1946,6 +1975,7 @@ $sheet-max-width: 860px &.oe_form_field_float,&.oe_form_view_integer input text-align: right + width: 100% &.oe_form_field_datetime,&.oe_form_field_date > span width: 100% @@ -2068,13 +2098,16 @@ $sheet-max-width: 860px text-indent: -9001px td.oe_list_field_handle width: 1em + padding: 0 !important cursor: ns-resize .oe_list_handle - @include text-to-icon("ö") + @include text-to-entypo-icon("}",#E0E0E0,18px) + margin-right: 7px .oe_list_cannot_edit .oe_list_header_handle, .oe_list_field_handle display: none !important + padding: 0 !important .oe_list_cannot_delete .oe_list_record_delete display: none !important 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/view_form.js b/addons/web/static/src/js/view_form.js index 5b7314a00f2..af1980b7b6e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -162,8 +162,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM 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) + $button.effect('bounce', {distance: 18, times: 5}, 150); e.stopPropagation(); + instance.web.bus.trigger('click', e); } }); @@ -270,9 +271,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM if (this.$buttons) { this.$buttons.show(); } - if (this.$pager) { - this.$pager.show(); - } this.$el.show().css({ opacity: '0', filter: 'alpha(opacity = 0)' @@ -408,7 +406,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.$pager.remove(); if (this.get("actual_mode") === "create") return; - this.$pager = $(QWeb.render("FormView.pager", {'widget':self})); + this.$pager = $(QWeb.render("FormView.pager", {'widget':self})).hide(); if (this.options.$pager) { this.$pager.appendTo(this.options.$pager); } else { @@ -421,10 +419,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.toggle(this.dataset.ids.length > 1); + if (hide_index) { + $(".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; @@ -2614,6 +2614,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]]), @@ -2721,6 +2722,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) { @@ -2751,26 +2778,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"); @@ -2824,10 +2848,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) { @@ -2847,25 +2871,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; @@ -3005,13 +3029,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); }, }); 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 45ec5c432f0..f0b9d624607 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -742,7 +742,7 @@