summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-09-21 12:22:43 +0200
committerqsm-odoo <qsm@odoo.com>2017-09-21 14:51:12 +0200
commitb51b0d66c2f71593d5eb3f153d55b1b97d979da7 (patch)
tree71e4eaa0f5ca055e14cb7557e0af6f5dc89af523 /addons/web/static/src/js/widgets
parent5b216c03c1c65f8c0ff651d21bad4177926c7621 (diff)
[FIX] web: open domain selector's datepicker at the right position
Before this commit, and since the combination of new views + datepicker library update, the datepicker opened at the top left of the window when using it in a domain selector. It also could not be used at all. This was because the current scenario occured: 1) Click on the datepicker 2) The datepicker triggers that it has changed on opening 3) The whole domain selector is rerendered 4) The datepicker computes where it should open... on basis of the old destroyed domain selector As the main cause of the problem here was the (2), this commit changes the datepicker odoo widget to only notifies that it has changed when it has really changed.
Diffstat (limited to 'addons/web/static/src/js/widgets')
-rw-r--r--addons/web/static/src/js/widgets/date_picker.js11
1 files changed, 9 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 76281d9366a..b95a1c4f936 100644
--- a/addons/web/static/src/js/widgets/date_picker.js
+++ b/addons/web/static/src/js/widgets/date_picker.js
@@ -74,9 +74,16 @@ var DateWidget = Widget.extend({
* set datetime value
*/
changeDatetime: function () {
- if(this.isValid()) {
+ if (this.isValid()) {
+ var oldValue = this.getValue();
this._setValueFromUi();
- this.trigger("datetime_changed");
+ var newValue = this.getValue();
+
+ if (!oldValue !== !newValue || oldValue && newValue && !oldValue.isSame(newValue)) {
+ // The condition is strangely written; this is because the
+ // values can be false/undefined
+ this.trigger("datetime_changed");
+ }
}
},
/**