diff options
| author | Aaron Bohy <aab@odoo.com> | 2018-09-17 12:12:41 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-09-17 15:23:33 +0200 |
| commit | c63630d41622412261401300775c0f720e6acbef (patch) | |
| tree | 094c2ecc786979b6f02921612864f95f84d54aa4 /addons/web/static/src/js/fields/basic_fields.js | |
| parent | 76a557c9ace456bdc538d90992b6aeaacc3c3395 (diff) | |
[FIX] web: datepicker: correctly use lib
The datepicker lib has been updated to tempus dominus (BS4)
recently, but our code hasn't been adapted correctly to the
requirements of the new version of the lib. As a consequence,
the datepicker didn't close itself when the input was focused
out anymore.
This required a slight change in the DomainSelector widget as it
produced a crash when a focused datepicker widget is removed from
the DOM (before the datepicker is destroyed), e.g. by a call to
html() on one of its parent.
Task 1878254
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index d3ca9a653fd..0a397a65047 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -526,6 +526,25 @@ var FieldDate = InputField.extend({ }, //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * Asks the datepicker widget to activate the input, instead of doing it + * ourself, such that 'input' events triggered by the lib are correctly + * intercepted, and don't produce unwanted 'field_changed' events. + * + * @override + */ + activate: function () { + if (this.datewidget) { + this.datewidget.focus(); + return true; + } + return false; + }, + + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- |
