[FIX] web: restore datepicker lib patches

Patches were introduced by Odoo in the lib and have been removed
while updating it to "tempus dominus". This commit restores them.

See:
- https://github.com/odoo/odoo/commit/3741603495532e218b66f3cfa0272e4536f1cf2c
- https://github.com/odoo/odoo/commit/ab42507d460125c5ee81bb6b4b859146494339ac
This commit is contained in:
qsm-odoo
2018-07-27 12:36:54 +02:00
parent 6692919d1e
commit 43d2db9439
@@ -561,9 +561,18 @@ var DateTimePicker = function ($, moment) {
};
DateTimePicker.prototype._notifyEvent = function _notifyEvent(e) {
if (e.type === DateTimePicker.Event.CHANGE && e.date && e.date.isSame(e.oldDate) || !e.date && !e.oldDate) {
// /!\ ODOO FIX: these next conditions have been modified by odoo
// FIXME should write a test about the tricky case this handles
if (!e.date && !e.oldDate) {
return;
}
if (e.type === DateTimePicker.Event.CHANGE) {
// check _isUTC flag to ensure that we are not comparing apples and oranges
var bothUTC = e.date && e.oldDate && e.date._isUTC === e.oldDate._isUTC;
if (bothUTC && e.date.isSame(e.oldDate)) {
return;
}
}
this._element.trigger(e);
};
@@ -1856,6 +1865,11 @@ var TempusDominusBootstrap4 = function ($) {
self._element.children().first().after(self.widget);
}
// /!\ ODOO FIX: the 3 next lines have been *added* by odoo
var parentOffset = parent.offset();
position.top = offset.top - parentOffset.top;
position.left = offset.left - parentOffset.left;
// Top and bottom logic
if (vertical === 'auto') {
//noinspection JSValidateTypes