Merge lp:~openerp-dev/openobject-addons/7.0-opw-596732-msh into lp:openobject-addons

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-596732-msh
Merge into: lp:openobject-addons
Diff against target: 53 lines (+18/-3)
1 file modified
board/static/src/js/dashboard.js (+18/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-596732-msh
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) Pending
Review via email: mp+211865@code.launchpad.net

Description of the change

Hello,

Fixed the issue of add to dashboard and evaluated domain, while adding dashboard we should add row domain as it is and should evaluate it when dashboard action is loaded otherwise dynamic domain value like context.today etc will not work, instead evaluated date is applied and dashboard will not give proper result.

Demo:- Open any tree view which has Filter based on date/relative_delta/today, filter your data using that date, say for example I have filter like ('date_action','<=', (context_today() + relativedelta(days=7)).strftime('%Y-%m-%d’)) so when I filter data with this filter and then add this view into dashboard then next day that view will give wrong result.

Reason: While Adding view into dashbaord, evaluated domain and context stored in the dashboard action, domain and context should be stored as it is and when action is loaded at that time action domain and context should be evaluated.

Thanks.

To post a comment you must log in.

Unmerged revisions

9856. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Re-fixed the issue of add to dashboard and evaluated domain, while adding dashboard we should add row domain as it is and should evaluate it when dashboard action is loaded otherwise dynamic domain value like context.today etc will not work, instead evaluated date is applied and dashboard will not give proper result.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'board/static/src/js/dashboard.js'
2--- board/static/src/js/dashboard.js 2013-10-27 12:31:04 +0000
3+++ board/static/src/js/dashboard.js 2014-03-20 05:02:17 +0000
4@@ -177,6 +177,11 @@
5 view_mode = action_attrs.view_mode;
6
7 // evaluate action_attrs context and domain
8+
9+ var comp_domain = new instance.web.CompoundDomain();
10+ _.each(eval(action_attrs.domain), comp_domain.add, comp_domain);
11+ action_attrs.domain = comp_domain.eval();
12+
13 action_attrs.context_string = action_attrs.context;
14 action_attrs.context = instance.web.pyeval.eval(
15 'context', action_attrs.context || {});
16@@ -377,10 +382,21 @@
17 }
18 var data = getParent.build_search_data();
19 var context = new instance.web.CompoundContext(getParent.dataset.get_context() || []);
20- var domain = new instance.web.CompoundDomain(getParent.dataset.get_domain() || []);
21+ //used dataset.domain instead of dataset.get_domain, because model domain will be evaluated domain
22+ //We need unevaluated domain of action as well as search build
23+ var domain = new instance.web.CompoundDomain(getParent.dataset.domain || []);
24 _.each(data.contexts, context.add, context);
25 _.each(data.domains, domain.add, domain);
26
27+ var dd = [];
28+ _(domain.__domains).each(function(dom) {
29+ if (dom instanceof instance.web.CompoundDomain) {
30+ dd.push(instance.web.pyeval.eval('domain', dom));
31+ } else if (dom.length) {
32+ dd.push(dom);
33+ }
34+ });
35+
36 context.add({
37 group_by: instance.web.pyeval.eval('groupbys', data.groupbys || [])
38 });
39@@ -393,13 +409,12 @@
40 }
41 // TODO: replace this 6.1 workaround by attribute on <action/>
42 c.dashboard_merge_domains_contexts = false;
43- var d = instance.web.pyeval.eval('domain', domain);
44
45 this.rpc('/board/add_to_dashboard', {
46 menu_id: this.$el.find("select").val(),
47 action_id: view_parent.action.id,
48 context_to_save: c,
49- domain: d,
50+ domain: JSON.stringify(dd),
51 view_mode: view_parent.active_view,
52 name: this.$el.find("input").val()
53 }).done(function(r) {

Subscribers

People subscribed via source and target branches

to all changes: