[FIX] web: on calendar with date and time, focus in the field only when hidden
The behavior of the datetime widget was to focus in the field every time a date is chosen. This causes an issue if the datetime widget is called from an editable list. Indeed, the list editable will consider that the value has been set, and therefore the value will not be changed anymore if the user choses another date. The new behavior is to put the focus only when the date picker is hidden, therefore the editable list will consider the value set only when the selection is done. opw-644062 Fixes #7463
This commit is contained in:
parent
6490c62e5d
commit
b4efb4eeb3
|
@ -2689,7 +2689,7 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({
|
|||
});
|
||||
|
||||
this.picker({
|
||||
onClose: this.on_picker_select,
|
||||
onClose: this.on_picker_close,
|
||||
onSelect: this.on_picker_select,
|
||||
changeMonth: true,
|
||||
changeYear: true,
|
||||
|
@ -2718,12 +2718,15 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({
|
|||
picker: function() {
|
||||
return $.fn[this.jqueryui_object].apply(this.$input_picker, arguments);
|
||||
},
|
||||
on_picker_close: function (text, instance_) {
|
||||
this.on_picker_select(text, instance_);
|
||||
this.$input.focus();
|
||||
},
|
||||
on_picker_select: function(text, instance_) {
|
||||
var date = this.picker('getDate');
|
||||
this.$input
|
||||
.val(date ? this.format_client(date) : '')
|
||||
.change()
|
||||
.focus();
|
||||
.change();
|
||||
},
|
||||
set_value: function(value_) {
|
||||
this.set({'value': value_});
|
||||
|
|
Loading…
Reference in New Issue