Merge lp:~openerp-dev/openerp-web/7.0-active-id-in-context-one-fix-to-rule-them-all-fme into lp:openerp-web/7.0

Proposed by Fabien Meghazi (OpenERP)
Status: Merged
Merged at revision: 3741
Proposed branch: lp:~openerp-dev/openerp-web/7.0-active-id-in-context-one-fix-to-rule-them-all-fme
Merge into: lp:openerp-web/7.0
Diff against target: 28 lines (+6/-5)
1 file modified
addons/web/static/src/js/views.js (+6/-5)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-active-id-in-context-one-fix-to-rule-them-all-fme
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Approve
Review via email: mp+146606@code.launchpad.net

Description of the change

This branch change the heuristic used in order to disable custom default filters in search.

Before :
- We disabled them when `active_id` string was found in the context string (unevaluated) in View#do_execute_action()

Now :
- In ActionManager#do_action(), just after the action context is evaluated, when an `active_id` is present in the context, we disable the default custom filters

To post a comment you must log in.
3742. By Fabien Meghazi (OpenERP)

[IMP] Also check the presence of active_ids

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/views.js'
2--- addons/web/static/src/js/views.js 2013-02-04 12:43:48 +0000
3+++ addons/web/static/src/js/views.js 2013-02-05 12:12:20 +0000
4@@ -272,6 +272,12 @@
5 if (action.context) {
6 action.context = instance.web.pyeval.eval(
7 'context', action.context);
8+ if (action.context.active_id || action.context.active_ids) {
9+ // Here we assume that when an `active_id` or `active_ids` is used
10+ // in the context, we are in a `related` action, so we disable the
11+ // searchview's default custom filters.
12+ action.context.search_disable_custom_filters = true;
13+ }
14 }
15 if (action.domain) {
16 action.domain = instance.web.pyeval.eval(
17@@ -1276,11 +1282,6 @@
18 active_ids: [record_id],
19 active_model: dataset.model
20 });
21- if (("" + action.context).match(/\bactive_id\b/)) {
22- // Special case: when the context is evaluted using
23- // the active_id, we want to disable the custom filters.
24- ncontext.add({ search_disable_custom_filters: true });
25- }
26 }
27 ncontext.add(action.context || {});
28 action.context = ncontext;