From 69d60465ee67969d72210a61a9e23204d037378a Mon Sep 17 00:00:00 2001 From: Rifakat Haradwala Date: Wed, 22 Oct 2014 15:37:00 +0530 Subject: [FIX] web: date autocompletion should use user's locale search bar does not suggest date field format based on user's locale and always shows based on mmddyy using Date.parse, opw:615276 Note: starting in 9.0, datejs has been replaced by momentjs, so this problem should be solved in a better way. --- addons/web/static/src/js/search.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index c09661f430d..89cf5521db1 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1497,7 +1497,11 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst return instance.web.date_to_str(facetValue.get('value')); }, complete: function (needle) { - var d = Date.parse(needle); + try { + var d = instance.web.str_to_date(instance.web.parse_value(needle, {'widget': 'date'})); + } catch (e) { + return false; + } if (!d) { return $.when(null); } var date_string = instance.web.format_value(d, this.attrs); var label = _.str.sprintf(_.str.escapeHTML( -- cgit v1.2.3 From da15c9d27b420e7643048dfab07aebcf94b92b4a Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 14 Nov 2014 15:49:39 +0100 Subject: [FIX] web: do not set the one2many dirty on field validation This rev. 06104ba553702b16878d52c5b8ab089355216a5e Added the dirty flag on the o2m field when the editor of the editable list was enabled (meaning that the editable list has been altered)) because the dirty flag was not set correctly by the one2many during the edition, at the time. It looks like this is now the case Besides, as now, we valid all the editable list of the form, wether or not the editable list was altered, we must not set the o2m as dirty anymore. --- addons/web/static/src/js/view_form.js | 1 - 1 file changed, 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 819920f89b3..be16faa309a 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3885,7 +3885,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ if (!this.fields_view || !this.editable()){ return true; } - this.o2m._dirty_flag = true; var r; return _.every(this.records.records, function(record){ r = record; -- cgit v1.2.3 From 922a52dcde24749aa3e640a940be462b85c075dd Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 14 Nov 2014 17:57:10 +0100 Subject: [FIX] web: date autocompletion should not harcode 'date' But should use date or datetime according to the widget type This fix is related to 69d60465ee67969d72210a61a9e23204d037378a --- addons/web/static/src/js/search.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 89cf5521db1..d2db5b55213 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1497,10 +1497,18 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst return instance.web.date_to_str(facetValue.get('value')); }, complete: function (needle) { + var d; try { - var d = instance.web.str_to_date(instance.web.parse_value(needle, {'widget': 'date'})); + var t = (this.attrs && this.attrs.type === 'datetime') ? 'datetime' : 'date'; + var v = instance.web.parse_value(needle, {'widget': t}); + if (t === 'datetime'){ + d = instance.web.str_to_datetime(v); + } + else{ + d = instance.web.str_to_date(v); + } } catch (e) { - return false; + // pass } if (!d) { return $.when(null); } var date_string = instance.web.format_value(d, this.attrs); -- cgit v1.2.3