summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets/date_picker.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-03-01 12:41:30 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commite357e267351b5a4c702cccebf4858327712984e0 (patch)
tree8cc6f51f35980a412d4f6ed338acb0b19e18cc2a /addons/web/static/src/js/widgets/date_picker.js
parent60a518dcce6f70fb46ebe7ce3f7a14f951f3e6c5 (diff)
[FIX] web: fix FieldDate widget default value
The FieldDate widget did not properly select the correct default value when opening the datepicker. We did not notice it, because the test hardcoded the february month.
Diffstat (limited to 'addons/web/static/src/js/widgets/date_picker.js')
-rw-r--r--addons/web/static/src/js/widgets/date_picker.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js
index 1acccc61a5e..3e4a0f4382f 100644
--- a/addons/web/static/src/js/widgets/date_picker.js
+++ b/addons/web/static/src/js/widgets/date_picker.js
@@ -50,13 +50,14 @@ var DateWidget = Widget.extend({
this.picker = this.$input.data('DateTimePicker');
this.$input.click(this.picker.toggle.bind(this.picker));
this.set_readonly(false);
- this.set_value(false);
},
set_value: function(value) {
this.set({'value': value});
var formatted_value = value ? this.format_client(value) : null;
this.$input.val(formatted_value);
- this.picker.date(formatted_value);
+ if (this.picker) {
+ this.picker.date(formatted_value);
+ }
},
get_value: function() {
return this.get('value');