Rifakat (OpenERP) has proposed merging
lp:~openerp-dev/openobject-server/6.0-opw-19972-rha into
lp:openobject-server/6.0.
Requested reviews:
nel (nel-tinyerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-19972-rha/+merge/82502
Hello,
Corrected behavior of search method of osv memory object which was giving wrong
result with limit and offset.
Currently it was searching for records till the limit instead of giving number
of record of that limit and offset did not take into account also.
Regards,
Rifakat
--
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-19972-rha/+merge/82502
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-server/6.0-opw-19972-rha.
=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py 2011-09-30 12:22:46 +0000
+++ bin/osv/orm.py 2011-11-17 06:25:52 +0000
@@ -2058,14 +2058,17 @@
return self.datas.keys()
res = []
- counter = 0
+ counter = 1
#Find the value of dict
f = False
if result:
for id, data in self.datas.items():
- counter = counter + 1
data['id'] = id
- if limit and (counter > int(limit)):
+ # If no offset, give the first entries between 0 and the limit
+ if not offset and limit and (counter > int(limit)):
+ break
+ # If offset, give only entries between offset and the offset+limit
+ elif offset and limit and (counter > int(limit + offset)):
break
f = True
for arg in result:
@@ -2075,11 +2078,11 @@
val = eval('data[arg[0]]'+arg[1] +' arg[2]', locals())
elif arg[1] in ['ilike']:
val = (str(data[arg[0]]).find(str(arg[2]))!=-1)
-
f = f and val
-
if f:
- res.append(id)
+ if counter > offset:
+ res.append(id)
+ counter += 1
if count:
return len(res)
return res or []
_______________________________________________
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