summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorJairo Llopis <yajo.sk8@gmail.com>2018-06-04 11:35:02 +0100
committerThibault Delavallée <tde@odoo.com>2018-06-13 14:53:11 +0200
commit71334b13bd31c7f5a0c1704584b28274785f95e3 (patch)
tree8ff26f26dd5180d1a6c4504701a881cdd8f37b24 /addons/web/static/src/js/fields
parent4d3debe2c328248a6c1643b278bd8170b2f016c0 (diff)
[IMP] web: Expose datepicker configuration to view declarations
The lower-level widget itself supports passing options to the underlying datepicker library. However this is not exposed to higher-level view declaration. With this patch, one can declare a field in a view such as: ```xml <field name="datefield" options='{"daysOfWeekDisabled": [0, 6]}'/> ``` That option would land in the widget and disable those weekdays. Documentation has been updated accordingly. Closes #25044.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index ac8ad02b24a..ba4169d2617 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -468,7 +468,13 @@ var FieldDate = InputField.extend({
* @private
*/
_makeDatePicker: function () {
- return new datepicker.DateWidget(this, {defaultDate: this.value});
+ return new datepicker.DateWidget(
+ this,
+ _.defaults(
+ this.nodeOptions.datepicker || {},
+ {defaultDate: this.value}
+ )
+ );
},
/**