Merge lp:~openerp-dev/openobject-client-web/5.0-opw-576069-msh into lp:openobject-client-web/5.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-client-web/5.0-opw-576069-msh
Merge into: lp:openobject-client-web/5.0
Diff against target: 93 lines (+12/-14)
2 files modified
openerp/widgets/screen.py (+11/-12)
openerp/widgets/tinycalendar/base.py (+1/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-client-web/5.0-opw-576069-msh
Reviewer Review Type Date Requested Status
OpenERP R&D Web Team Pending
Review via email: mp+115303@code.launchpad.net

Description of the change

Hello,

Fixed the issue of search domain not passed in switch view.

Search domain should be passed while switching the view, like if I am in list view, there are thousands of record which I have filtered using search view, now when I switch the view I'll have all the data which is bot a proper behaviour.

If I am filtering the data and switching the view, so I should have the view with only filtered record.

Currently this is not working because while switching the view we have not passed the search_domain.

Also improved the calendar view domain, as in month view I need only the events of current month + the events of the previous month whose day shown in current month + days of next month which are shown on current month.

Thanks.

To post a comment you must log in.

Unmerged revisions

2959. By Mohammed Shekha(Open ERP)

[FIX]Fix the issue of search_domain not passed in switch view, when we have filtered the record so while switching the view only with that record view should shown.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/widgets/screen.py'
2--- openerp/widgets/screen.py 2010-12-06 10:17:54 +0000
3+++ openerp/widgets/screen.py 2012-07-17 09:20:28 +0000
4@@ -137,12 +137,11 @@
5 view = cache.fields_view_get(self.model, view_id, view_type, ctx, self.hastoolbar)
6
7 fields = view['fields']
8- domain = self.domain
9+ self.search_domain = self.domain
10 terp_params = getattr(cherrypy.request, 'terp_params', {})
11- if view_type == 'tree':
12- domain = filter(lambda val:val not in self.domain, terp_params.get('_terp_search_domain') or [])
13+ self.search_domain = filter(lambda val:val not in self.domain, terp_params.get('_terp_search_domain') or [])
14
15- for dom in domain:
16+ for dom in self.search_domain:
17 if dom[0] in fields:
18 field_dom = str(fields[dom[0]].setdefault('domain', []))
19 fields[dom[0]]['domain'] = field_dom[:1] + str(('id', dom[1], dom[2])) + ',' + field_dom[1:]
20@@ -158,7 +157,7 @@
21 model=self.model,
22 view=view,
23 ids=(self.id or []) and [self.id],
24- domain=self.domain,
25+ domain=self.search_domain,
26 context=self.context,
27 editable=self.editable,
28 readonly=self.readonly,
29@@ -166,15 +165,15 @@
30
31 if not self.is_wizard and self.ids is None:
32 proxy = rpc.RPCProxy(self.model)
33- self.ids = proxy.search(self.domain, self.offset or False, self.limit or 20, 0, self.context)
34- self.count = proxy.search_count(self.domain, self.context)
35+ self.ids = proxy.search(self.search_domain, self.offset or False, self.limit or 20, 0, self.context)
36+ self.count = proxy.search_count(self.search_domain, self.context)
37
38 elif view_type == 'tree':
39 self.widget = listgrid.List(self.name or '_terp_list',
40 model=self.model,
41 view=view,
42 ids=self.ids,
43- domain=self.domain,
44+ domain=self.search_domain,
45 context=self.context,
46 view_mode=self.view_mode,
47 editable=self.editable,
48@@ -190,19 +189,19 @@
49 view=view,
50 view_id=view.get('view_id', False),
51 view_ids = self.view_ids,
52- ids=self.ids, domain=self.domain,
53+ ids=self.ids, domain=self.search_domain,
54 context=self.context)
55 self.ids = self.widget.ids
56
57 elif view_type == 'calendar':
58 if self.ids is None:
59 proxy = rpc.RPCProxy(self.model)
60- self.ids = proxy.search(self.domain, self.offset or False, self.limit or False, 0, self.context)
61+ self.ids = proxy.search(self.search_domain, self.offset or False, self.limit or False, 0, self.context)
62
63 self.widget = tinycalendar.get_calendar(view=view,
64 model=self.model,
65 ids=self.ids,
66- domain=self.domain,
67+ domain=self.search_domain,
68 context=self.context,
69 options=self.kalendar)
70
71@@ -210,7 +209,7 @@
72 self.widget = tinycalendar.GanttCalendar(model=self.model,
73 view=view,
74 ids=self.ids,
75- domain=self.domain,
76+ domain=self.search_domain,
77 context=self.context,
78 options=self.kalendar)
79
80
81=== modified file 'openerp/widgets/tinycalendar/base.py'
82--- openerp/widgets/tinycalendar/base.py 2010-08-10 10:09:11 +0000
83+++ openerp/widgets/tinycalendar/base.py 2012-07-17 09:20:28 +0000
84@@ -231,8 +231,7 @@
85 #domain = self.domain + [(self.date_start, '>', days[0].prev().isoformat()),
86 # (self.date_start, '<', days[-1].next().isoformat())]
87
88- first = days[0].month2.prev()[0] #HACK: add prev month
89- domain = self.domain + [(self.date_start, '>', first.isoformat()),
90+ domain = self.domain + [(self.date_start, '>', days[0].prev().isoformat()),
91 (self.date_start, '<', days[-1].next().isoformat())]
92
93 # convert color values from string to python values