diff options
| author | Christophe Simonis <chs@odoo.com> | 2014-06-19 16:23:32 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2014-06-19 16:23:32 +0200 |
| commit | eef6330c55bc7d829359fbb733a1adc4c149309b (patch) | |
| tree | 11dede8d58d1db5d3f2998e79b3ecd9dd0e76776 /addons/web/static/src | |
| parent | dc4178a9624e49b6bad7dc924206b22fc23d435e (diff) | |
| parent | adf07a9490436211d16da8b1355c3bae4448a54a (diff) | |
[MERGE] forward port of branch saas-5 up to adf07a9
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 5 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/formats.js | 13 | ||||
| -rw-r--r-- | addons/web/static/src/js/search.js | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 5 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list_editable.js | 43 |
6 files changed, 32 insertions, 42 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index b234e2738df..9988e7eae74 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2373,7 +2373,7 @@ } .openerp .oe_fileupload .oe_add button.oe_attach .oe_e { position: relative; - top: -1px; + top: -10px; left: -9px; } .openerp .oe_fileupload .oe_add input.oe_form_binary_file { @@ -3324,6 +3324,9 @@ body.oe_single_form .oe_single_form_container { .openerp_ie ul.oe_form_status li.oe_active > .arrow span, .openerp_ie ul.oe_form_status_clickable li.oe_active > .arrow span { background-color: #729fcf !important; } +} +.openerp_ie .oe_webclient { + height: auto !important; @media print { .openerp { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 093ebf6cb0b..b85346a2c8f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1939,7 +1939,7 @@ $sheet-padding: 16px text-shadow: none .oe_e position: relative - top: -1px + top: -10px left: -9px input.oe_form_binary_file display: inline-block @@ -2691,6 +2691,8 @@ body.oe_single_form > .arrow span background-color: #729fcf !important + .oe_webclient + height: auto !important // }}} // @media print {{{ diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 3c32dbe0426..f08dc31021a 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -233,7 +233,8 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { value = value.replace(instance.web._t.database.parameters.thousands_sep, ""); } while(tmp !== value); tmp = Number(value); - if (isNaN(tmp)) + // do not accept not numbers or float values + if (isNaN(tmp) || tmp % 1) throw new Error(_.str.sprintf(_t("'%s' is not a correct integer"), value)); return tmp; case 'float': @@ -270,6 +271,11 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { value, (date_pattern + ' ' + time_pattern)); if (datetime !== null) return instance.web.datetime_to_str(datetime); + datetime = Date.parseExact(value.replace(/\d+/g, function(m){ + return m.length === 1 ? "0" + m : m ; + }), (date_pattern + ' ' + time_pattern)); + if (datetime !== null) + return instance.web.datetime_to_str(datetime); datetime = Date.parse(value); if (datetime !== null) return instance.web.datetime_to_str(datetime); @@ -278,6 +284,11 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) { var date = Date.parseExact(value, date_pattern); if (date !== null) return instance.web.date_to_str(date); + date = Date.parseExact(value.replace(/\d+/g, function(m){ + return m.length === 1 ? "0" + m : m ; + }), date_pattern); + if (date !== null) + return instance.web.date_to_str(date); date = Date.parse(value); if (date !== null) return instance.web.date_to_str(date); diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 5653447566b..ac441d8eed6 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -346,11 +346,11 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea 'keydown .oe_searchview_input, .oe_searchview_facet': function (e) { switch(e.which) { case $.ui.keyCode.LEFT: - this.focusPreceding(this); + this.focusPreceding(e.target); e.preventDefault(); break; case $.ui.keyCode.RIGHT: - this.focusFollowing(this); + this.focusFollowing(e.target); e.preventDefault(); break; } diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e276a5e3995..cb0b2e8ea80 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2632,6 +2632,7 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ type_of_date: "datetime", events: { 'change .oe_datepicker_master': 'change_datetime', + 'keypress .oe_datepicker_master': 'change_datetime', }, init: function(parent) { this._super(parent); @@ -2750,8 +2751,8 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ format_client: function(v) { return instance.web.format_value(v, {"widget": this.type_of_date}); }, - change_datetime: function() { - if (this.is_valid_()) { + change_datetime: function(e) { + if ((e.type !== "keypress" || e.which === 13) && this.is_valid_()) { this.set_value_from_ui_(); this.trigger("datetime_changed"); } diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index e2c63eb191a..ea2c28d9c3f 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -130,15 +130,7 @@ if (this.editable()) { this.$el.find('table:first').show(); this.$el.find('.oe_view_nocontent').remove(); - this.start_edition().then(function(){ - var fields = self.editor.form.fields; - self.editor.form.fields_order.some(function(field){ - if (fields[field].$el.is(':visible')){ - fields[field].$el.find("input").select(); - return true; - } - }); - }); + this.start_edition(); } else { this._super(); } @@ -243,6 +235,7 @@ return this.ensure_saved().then(function () { var $recordRow = self.groups.get_row_for(record); var cells = self.get_cells_for($recordRow); + var fields = {}; self.fields_for_resize.splice(0, self.fields_for_resize.length); return self.with_event('edit', { record: record.attributes, @@ -256,10 +249,16 @@ // FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow field.$el.attr('data-fieldname', field_name); + fields[field_name] = field; self.fields_for_resize.push({field: field, cell: cell}); }, options).then(function () { $recordRow.addClass('oe_edition'); self.resize_fields(); + var focus_field = options && options.focus_field ? options.focus_field : undefined; + if (!focus_field){ + focus_field = _.find(self.editor.form.fields_order, function(field){ return fields[field] && fields[field].$el.is(':visible:has(input)'); }); + } + if (focus_field) fields[focus_field].$el.find('input').select(); return record.attributes; }); }).fail(function () { @@ -749,31 +748,6 @@ throw new Error("is_editing's state filter must be either `new` or" + " `edit` if provided"); }, - _focus_setup: function (focus_field) { - var form = this.form; - - var field; - // If a field to focus was specified - if (focus_field - // Is actually in the form - && (field = form.fields[focus_field]) - // And is visible - && field.$el.is(':visible')) { - // focus it - field.focus(); - return; - } - - _(form.fields_order).detect(function (name) { - // look for first visible field in fields_order, focus it - var field = form.fields[name]; - if (!field.$el.is(':visible')) { - return false; - } - // Stop as soon as a field got focused - return field.focus() !== false; - }); - }, edit: function (record, configureField, options) { // TODO: specify sequence of edit calls var self = this; @@ -788,7 +762,6 @@ _(form.fields).each(function (field, name) { configureField(name, field); }); - self._focus_setup(options && options.focus_field); return form; }); }, |
