summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets
diff options
context:
space:
mode:
authorPierre Paridans <app@odoo.com>2020-07-02 14:11:54 +0000
committerPierre Paridans <app@odoo.com>2020-07-03 15:54:08 +0000
commiteba83eddd4f5352dd721bb8f046714ee937a3aab (patch)
tree1c456639c1bdbb8c1b30447d4d0bc3c7361f7537 /addons/web/static/src/js/widgets
parent88786d6123afdc860db795c9f18cf974421e909d (diff)
[FIX] web: extract date picker's input setter
This commit extracts the DatePicker widget's input setter to allow overriding it and preventing from calling the `datetimepicker` lib when not initialized (like on mobile). Note: this change will be used on enterprise. opw-2242880 X-original-commit: c0413868a8728500c52b7e1dd9a0035f90b654fd
Diffstat (limited to 'addons/web/static/src/js/widgets')
-rw-r--r--addons/web/static/src/js/widgets/date_picker.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js
index 9ebd68813ee..0b19f0c4506 100644
--- a/addons/web/static/src/js/widgets/date_picker.js
+++ b/addons/web/static/src/js/widgets/date_picker.js
@@ -183,9 +183,7 @@ var DateWidget = Widget.extend({
this.set({'value': value});
var formatted_value = value ? this._formatClient(value) : null;
this.$input.val(formatted_value);
- this.__libInput++;
- this.$el.datetimepicker('date', value || null);
- this.__libInput--;
+ this._setLibInputValue(value);
},
//--------------------------------------------------------------------------
@@ -233,6 +231,15 @@ var DateWidget = Widget.extend({
},
/**
* @private
+ * @param {Moment|false} value
+ */
+ _setLibInputValue: function (value) {
+ this.__libInput++;
+ this.$el.datetimepicker('date', value || null);
+ this.__libInput--;
+ },
+ /**
+ * @private
* @param {boolean} readonly
*/
_setReadonly: function (readonly) {