Skip to content
Permalink
Browse files

[FIX] search_filters: broke a thing in f1a85ba

As part of fixing the JS docs (docstrings & references & ...), the
various search filters were de-namespaced (aka
ExtendedSearchProposition.Integer = ... -> var Integer = ...).

This had the side-effect of making a `new Date` refer to the extended
search Date field instead of the global Date object, which went
unnoticed because *that* had been wrapped in a moment() call, and
moment() apparently doesn't mind being given garbage, but it would also
create an "unbound" and thus never destroyed widget.

Remove the `new Date`, calling moment directly has pretty much the same
effect, moment objects created from date objects just have an extra
field (a cache for the date object I guess).

closes #30791
  • Loading branch information...
xmo-odoo committed Feb 4, 2019
1 parent 9837f25 commit f53ad8a4fd6f1b98625dd659e429177beae7ae80
Showing with 1 addition and 1 deletion.
  1. +1 −1 addons/web/static/src/js/chrome/search_filters.js
@@ -238,7 +238,7 @@ var DateTime = Field.extend({
_create_new_widget: function (name) {
this[name] = new (this._get_widget_class())(this);
return this[name].appendTo(this.$el).then((function () {
this[name].setValue(moment(new Date()));
this[name].setValue(moment());
}).bind(this));
},
_get_widget_class: function () {

0 comments on commit f53ad8a

Please sign in to comment.
You can’t perform that action at this time.