summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorfwi-odoo <fwi@odoo.com>2016-11-22 13:55:03 +0100
committerfwi-odoo <fwi@odoo.com>2017-01-30 10:29:27 +0100
commitad6fd5f838e174cc6e354bb9998e1e5bc4e8d4f1 (patch)
tree430a782eb2c08fa907473a7a31965d3859f279b9 /addons/web/static/src
parentc5af1d215f040a244f108730e8eb1c794353591c (diff)
[REF] web: update bootstrap-datetimepicker lib and adapt datepicker widget
from 3.0.3 to 4.17.42
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/widgets/date_picker.js24
-rw-r--r--addons/web/static/src/less/datepicker.less15
-rw-r--r--addons/web/static/src/xml/base.xml16
3 files changed, 35 insertions, 20 deletions
diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js
index 7f622f10820..74286da6df3 100644
--- a/addons/web/static/src/js/widgets/date_picker.js
+++ b/addons/web/static/src/js/widgets/date_picker.js
@@ -23,19 +23,20 @@ var DateWidget = Widget.extend({
this.name = parent.name;
this.options = _.defaults(options || {}, {
- pickTime: this.type_of_date === 'datetime',
- useSeconds: this.type_of_date === 'datetime',
- startDate: moment({ y: 1900 }),
- endDate: moment().add(200, "y"),
+ format : time.strftime_to_moment_format((this.type_of_date === 'datetime')? (l10n.date_format + ' ' + l10n.time_format) : l10n.date_format),
+ minDate: moment({ y: 1900 }),
+ maxDate: moment().add(200, "y"),
calendarWeeks: true,
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
+ next: 'fa fa-chevron-right',
+ previous: 'fa fa-chevron-left',
up: 'fa fa-chevron-up',
- down: 'fa fa-chevron-down'
+ down: 'fa fa-chevron-down',
},
- language : moment.locale(),
- format : time.strftime_to_moment_format((this.type_of_date === 'datetime')? (l10n.date_format + ' ' + l10n.time_format) : l10n.date_format),
+ locale : moment.locale(),
+ allowInputToggle: true,
});
},
start: function() {
@@ -48,7 +49,7 @@ var DateWidget = Widget.extend({
set_value: function(value) {
this.set({'value': value});
this.$input.val((value)? this.format_client(value) : '');
- this.picker.setValue(this.format_client(value));
+ this.picker.date(this.format_client(value));
},
get_value: function() {
return this.get('value');
@@ -88,12 +89,7 @@ var DateWidget = Widget.extend({
value = this.$input.val();
}
- // temporarily set pickTime to true to bypass datetimepicker hiding on setValue
- // see https://github.com/Eonasdan/bootstrap-datetimepicker/issues/603
- var saved_picktime = this.picker.options.pickTime;
- this.picker.options.pickTime = true;
- this.picker.setValue(value);
- this.picker.options.pickTime = saved_picktime;
+ this.picker.date(value);
},
change_datetime: function(e) {
if(this.is_valid()) {
diff --git a/addons/web/static/src/less/datepicker.less b/addons/web/static/src/less/datepicker.less
index 271cd357d15..29ae830280c 100644
--- a/addons/web/static/src/less/datepicker.less
+++ b/addons/web/static/src/less/datepicker.less
@@ -1,6 +1,21 @@
@odoo-datepicker-week-color: #8f8f8f;
@odoo-datepicker-week-bg-color: lighten(@odoo-datepicker-week-color, 30%);
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: -1px;
+ padding: 0;
+ overflow: hidden;
+ clip: rect(0,0,0,0);
+ border: 0;
+}
+
+.o_bootstrap_datepicker_parent{
+ position: relative;
+}
+
.o_datepicker {
position: relative;
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 108bf1c0aac..8abdf9160ed 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -829,13 +829,17 @@
<t t-name="web.datepicker">
<t t-set="placeholder" t-value="widget.getParent().node and widget.getParent().node.attrs.placeholder"/>
- <div class="o_datepicker">
- <input type="text"
- class="o_datepicker_input"
- t-att-name="widget.name"
- t-att-placeholder="placeholder"/>
- <span class="o_datepicker_button"/>
+ <div>
+ <div class="o_bootstrap_datepicker_parent"></div>
+ <div class="o_datepicker">
+ <input type="text"
+ class="o_datepicker_input"
+ t-att-name="widget.name"
+ t-att-placeholder="placeholder"/>
+ <span class="o_datepicker_button"/>
+ </div>
</div>
+
</t>
<t t-name="FieldSelection">
<span t-if="widget.get('effective_readonly')"/>