Mohammed Shekha(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/5.0-opw-576069-msh into 
lp:openobject-client-web/5.0.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/5.0-opw-576069-msh/+merge/115303

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.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/5.0-opw-576069-msh/+merge/115303
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/5.0-opw-576069-msh.
=== modified file 'openerp/widgets/screen.py'
--- openerp/widgets/screen.py	2010-12-06 10:17:54 +0000
+++ openerp/widgets/screen.py	2012-07-17 09:20:28 +0000
@@ -137,12 +137,11 @@
             view = cache.fields_view_get(self.model, view_id, view_type, ctx, self.hastoolbar)
 
         fields = view['fields']
-        domain = self.domain
+        self.search_domain = self.domain
         terp_params = getattr(cherrypy.request, 'terp_params', {})
-        if view_type == 'tree':
-            domain = filter(lambda val:val not in self.domain, terp_params.get('_terp_search_domain') or [])
+        self.search_domain = filter(lambda val:val not in self.domain, terp_params.get('_terp_search_domain') or [])
 
-        for dom in domain:
+        for dom in self.search_domain:
             if dom[0] in fields:
                 field_dom = str(fields[dom[0]].setdefault('domain', []))
                 fields[dom[0]]['domain'] = field_dom[:1] + str(('id', dom[1], dom[2])) + ',' + field_dom[1:]
@@ -158,7 +157,7 @@
                                     model=self.model,
                                     view=view,
                                     ids=(self.id or []) and [self.id],
-                                    domain=self.domain,
+                                    domain=self.search_domain,
                                     context=self.context,
                                     editable=self.editable,
                                     readonly=self.readonly,
@@ -166,15 +165,15 @@
 
             if not self.is_wizard and self.ids is None:
                 proxy = rpc.RPCProxy(self.model)
-                self.ids = proxy.search(self.domain, self.offset or False, self.limit or 20, 0, self.context)
-                self.count = proxy.search_count(self.domain, self.context)
+                self.ids = proxy.search(self.search_domain, self.offset or False, self.limit or 20, 0, self.context)
+                self.count = proxy.search_count(self.search_domain, self.context)
 
         elif view_type == 'tree':
             self.widget = listgrid.List(self.name or '_terp_list',
                                         model=self.model,
                                         view=view,
                                         ids=self.ids,
-                                        domain=self.domain,
+                                        domain=self.search_domain,
                                         context=self.context,
                                         view_mode=self.view_mode,
                                         editable=self.editable,
@@ -190,19 +189,19 @@
                                       view=view,
                                       view_id=view.get('view_id', False),
                                       view_ids = self.view_ids,
-                                      ids=self.ids, domain=self.domain,
+                                      ids=self.ids, domain=self.search_domain,
                                       context=self.context)
             self.ids = self.widget.ids
 
         elif view_type == 'calendar':
             if self.ids is None:
                 proxy = rpc.RPCProxy(self.model)
-                self.ids = proxy.search(self.domain, self.offset or False, self.limit or False, 0, self.context)
+                self.ids = proxy.search(self.search_domain, self.offset or False, self.limit or False, 0, self.context)
             
             self.widget = tinycalendar.get_calendar(view=view,
                                                     model=self.model,
                                                     ids=self.ids,
-                                                    domain=self.domain,
+                                                    domain=self.search_domain,
                                                     context=self.context,
                                                     options=self.kalendar)
 
@@ -210,7 +209,7 @@
             self.widget = tinycalendar.GanttCalendar(model=self.model,
                                                      view=view,
                                                      ids=self.ids,
-                                                     domain=self.domain,
+                                                     domain=self.search_domain,
                                                      context=self.context,
                                                      options=self.kalendar)
 

=== modified file 'openerp/widgets/tinycalendar/base.py'
--- openerp/widgets/tinycalendar/base.py	2010-08-10 10:09:11 +0000
+++ openerp/widgets/tinycalendar/base.py	2012-07-17 09:20:28 +0000
@@ -231,8 +231,7 @@
         #domain = self.domain + [(self.date_start, '>', days[0].prev().isoformat()),
         #                        (self.date_start, '<', days[-1].next().isoformat())]
 
-        first = days[0].month2.prev()[0] #HACK: add prev month
-        domain = self.domain + [(self.date_start, '>', first.isoformat()),
+        domain = self.domain + [(self.date_start, '>', days[0].prev().isoformat()),
                                 (self.date_start, '<', days[-1].next().isoformat())]
 
         # convert color values from string to python values

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to