Merge lp:~unifield-team/unifield-web/web-UF-1369 into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4673
Proposed branch: lp:~unifield-team/unifield-web/web-UF-1369
Merge into: lp:unifield-web
Diff against target: 48 lines (+10/-8)
2 files modified
addons/openerp/widgets/form/_m2m.py (+2/-7)
addons/openerp/widgets/listgrid.py (+8/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-web/web-UF-1369
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+131226@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/widgets/form/_m2m.py'
2--- addons/openerp/widgets/form/_m2m.py 2012-07-03 13:02:43 +0000
3+++ addons/openerp/widgets/form/_m2m.py 2012-10-24 15:45:48 +0000
4@@ -102,16 +102,11 @@
5 if isinstance(ids, tuple):
6 ids = list(ids)
7
8- if ids and current.limit != -1 and not params.sort_key:
9- ids = ids[current.offset: current.offset+current.limit]
10-
11 if self.name == params.source and params.sort_key and ids:
12+ # reorder ids based on supplier criteria (sort_key, sort_order)
13 domain = current.domain or []
14 domain.append(('id', 'in', ids))
15- limit = current.limit
16- if current.limit == -1:
17- limit = 0
18- ids = rpc.RPCProxy(self.model).search(domain, current.offset, limit, params.sort_key+ ' '+params.sort_order, current.context)
19+ ids = rpc.RPCProxy(self.model).search(domain, 0, 0, params.sort_key+ ' '+params.sort_order, current.context)
20 id = ids[0]
21
22 if current.view_mode: view_mode = current.view_mode
23
24=== modified file 'addons/openerp/widgets/listgrid.py'
25--- addons/openerp/widgets/listgrid.py 2012-08-13 14:26:51 +0000
26+++ addons/openerp/widgets/listgrid.py 2012-10-24 15:45:48 +0000
27@@ -182,6 +182,12 @@
28 else:
29 self.count = proxy.search_count(search_param, context)
30
31+ if not default_data and self.m2m:
32+ # prefilter datas for m2m
33+ # XXX: make it explicit about how 'sum' are computed as this is going to change default behaviour
34+ if ids and self.limit not in (0, -1):
35+ ids = self.ids[self.offset:self.offset+self.limit]
36+
37 self.data_dict = {}
38 data = []
39
40@@ -210,7 +216,8 @@
41 for item in data:
42 self.data_dict[item['id']] = item.copy()
43
44- self.ids = ids
45+ if not self.m2m:
46+ self.ids = ids
47 elif kw.get('default_data', []):
48 data = kw['default_data']
49

Subscribers

People subscribed via source and target branches

to all changes: