summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2014-06-19 15:32:32 +0200
committerChristophe Simonis <chs@odoo.com>2014-06-19 15:32:32 +0200
commitbf53aeda9436310f493a77fc24f8cc35f362ec5b (patch)
treebb21a7bb03af4fe33704bea934b5145e1c702feb /addons/web/static/src
parent5023816c5577b312b06f04355365f1243ed2cdc9 (diff)
parente5533d0c14cb107a73f85c7e5a76727be8fbc13a (diff)
[MERGE] forward port of branch 7.0 up to e5533d0
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/formats.js10
-rw-r--r--addons/web/static/src/js/search.js4
-rw-r--r--addons/web/static/src/js/view_form.js5
-rw-r--r--addons/web/static/src/js/view_list_editable.js5
4 files changed, 19 insertions, 5 deletions
diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js
index a56ab6be380..f08dc31021a 100644
--- a/addons/web/static/src/js/formats.js
+++ b/addons/web/static/src/js/formats.js
@@ -271,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);
@@ -279,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 8b400bec367..3a8484909a8 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -345,11 +345,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 b645db41eaa..f5af0963c7f 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -2440,6 +2440,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);
@@ -2558,8 +2559,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 fb7045477b6..ea2c28d9c3f 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -254,7 +254,10 @@
}, options).then(function () {
$recordRow.addClass('oe_edition');
self.resize_fields();
- var focus_field = options && options.focus_field ? options.focus_field : (self.visible_columns.length ? self.visible_columns[0].name : undefined);
+ 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;
});