summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-01-26 10:23:04 +0100
committerXavier Morel <xmo@openerp.com>2012-01-26 10:23:04 +0100
commitd0141aa5ced0626abc8d10bf819857b7337f771f (patch)
tree415f1e2d8271933cef887d2f1c0c689b3d8cbb37 /addons/web/static/src/js
parent1059bb758d36f128b6075adb9745aa5518d69157 (diff)
[FIX] race condition on selecting saved filters
Deferreds can't "go through" al callbacks, so even when searchviews correctly wait on this.on_clear it can't get the information on when the other view is done clearing, and it lauches two concurrent views. In this precise case though, there's no need to launch a search after this clear, just want to remove all searchview state. bzr revid: xmo@openerp.com-20120126092304-fe79ulj6txkgy411
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/search.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index ae38f7dbf25..96af74672d3 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -259,7 +259,7 @@ openerp.web.SearchView = openerp.web.OldWidget.extend(/** @lends openerp.web.Sea
val = val.slice(4);
val = parseInt(val, 10);
var filter = this.managed_filters[val];
- this.do_clear().then(_.bind(function() {
+ this.do_clear(false).then(_.bind(function() {
select.val('get:' + val);
var groupbys = _.map(filter.context.group_by.split(","), function(el) {
return {"group_by": el};
@@ -412,7 +412,10 @@ openerp.web.SearchView = openerp.web.OldWidget.extend(/** @lends openerp.web.Sea
on_invalid: function (errors) {
this.do_notify(_t("Invalid Search"), _t("triggered from search view"));
},
- do_clear: function () {
+ /**
+ * @param {Boolean} [reload_view=true]
+ */
+ do_clear: function (reload_view) {
this.$element.find('.filter_label, .filter_icon').removeClass('enabled');
this.enabled_filters.splice(0);
var string = $('a.searchview_group_string');
@@ -427,7 +430,8 @@ openerp.web.SearchView = openerp.web.OldWidget.extend(/** @lends openerp.web.Sea
input.datewidget.set_value(false);
}
});
- return $.async_when().pipe(this.on_clear);
+ return $.async_when().pipe(
+ reload_view !== false ? this.on_clear : null);
},
/**
* Triggered when the search view gets cleared