diff options
| author | fwi-odoo <fwi@odoo.com> | 2017-02-08 12:53:34 +0100 |
|---|---|---|
| committer | fwi-odoo <fwi@odoo.com> | 2017-02-08 12:53:34 +0100 |
| commit | 5bd0318594010aa9987976f616f051b41497f68b (patch) | |
| tree | df87a2eb3aa4ac3d3f50f0eeeb42db8d033b8e45 /addons/web/static/src/js/widgets | |
| parent | 2e40f532799ef9456de3addb1aa120d8efa70f71 (diff) | |
[FIX] web: use the default library behaviour
The library reset the time set when the date is changed.
Then it was not possible to set the time then set the date
and expect the widget to close since the time will be reset
to the default value.
Instead we use the library behaviour and add a 'close' button
for the datetime widgets.
Diffstat (limited to 'addons/web/static/src/js/widgets')
| -rw-r--r-- | addons/web/static/src/js/widgets/date_picker.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js index 90ec9ed58c6..20171e554a2 100644 --- a/addons/web/static/src/js/widgets/date_picker.js +++ b/addons/web/static/src/js/widgets/date_picker.js @@ -34,6 +34,7 @@ var DateWidget = Widget.extend({ previous: 'fa fa-chevron-left', up: 'fa fa-chevron-up', down: 'fa fa-chevron-down', + close: 'fa fa-times', }, locale : moment.locale(), allowInputToggle: true, @@ -96,16 +97,11 @@ var DateWidget = Widget.extend({ this.picker.date(value); }, - change_datetime: function(e) { + change_datetime: function() { if(this.is_valid()) { this.set_value_from_ui(); this.trigger("datetime_changed"); } - //Close the datetimepicker when a date is selected - //We check only if the date has changed. - if(!e.date.isSame(e.oldDate, 'day')){ - this.picker.hide(); - } }, commit_value: function() { this.change_datetime(); @@ -117,7 +113,13 @@ var DateWidget = Widget.extend({ }); var DateTimeWidget = DateWidget.extend({ - type_of_date: "datetime" + type_of_date: "datetime", + init: function() { + this._super.apply(this, arguments); + this.options = _.defaults(this.options, { + showClose: true, + }); + }, }); return { |
