Mohammed Shekha(Open ERP) has proposed merging
lp:~openerp-dev/openobject-client-web/6.0-opw-383575-msh into
lp:openobject-client-web.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-383575-msh/+merge/92917
Hello,
Fixed the issue of one2many pager which ignores pager count when sorting also
the one2many reads all the records even though limit set to 20 or 50.
Case 383575
Demo :- When one2many of any form view is loaded, it will read all the ids even
though I have set limit=20 or 50.
For e.g.
if have 400 records and set the limit to 50, 50 records are
shown, but the web client reads 400 records from the server !
Case 383574
Demo:- Open any form view in which there is one2many field, now sort the
one2many field by header label, here the pager is stop to working.
say if I have 55 records and limit=50, now I sort it by header label, you will
see the pager will stop to work or it will show wrong counter.
Changed the code in _o2m so that both the issue fixed.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-383575-msh/+merge/92917
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-client-web/6.0-opw-383575-msh.
=== modified file 'addons/openerp/widgets/form/_o2m.py'
--- addons/openerp/widgets/form/_o2m.py 2011-04-06 13:01:31 +0000
+++ addons/openerp/widgets/form/_o2m.py 2012-02-14 06:39:23 +0000
@@ -142,6 +142,13 @@
if not isinstance(ids, list):
ids = [ids]
+ current.offset = current.offset or 0
+ current.limit = current.limit or 50
+ current.count = len(ids or [])
+
+ if current.limit != -1 and not params.sort_key:
+ ids = ids[current.offset: current.offset+current.limit]
+
if ids:
if isinstance(ids[0], dict):
current.default_data = ids
@@ -159,7 +166,10 @@
if params.sort_key and ids:
domain = current.domain or []
domain.append(('id', 'in', ids))
- ids = rpc.RPCProxy(self.model).search(domain, current.offset, current.limit, params.sort_key + ' '+params.sort_order, current.context)
+ limit = current.limit
+ if current.limit == -1:
+ limit = 0
+ ids = rpc.RPCProxy(self.model).search(domain, current.offset, limit, params.sort_key + ' '+params.sort_order, current.context)
id = ids[0]
if current and params.source and self.name in params.source.split('/'):
id = current.id
@@ -195,10 +205,6 @@
if ctx and ctx.get('group_by'):
group_by_ctx = ctx.get('group_by')
- current.offset = current.offset or 0
- current.limit = current.limit or 50
- current.count = len(ids or [])
-
# Group By for one2many list.
if group_by_ctx:
current.group_by_ctx = group_by_ctx
_______________________________________________
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