@@ -195,7 +195,11 @@ def test_search(self):
195195 self .assertIsInstance (FooBar .search ([searchterm ]), odooly .RecordList )
196196 FooBar .search ([searchterm ], limit = 2 )
197197 FooBar .search ([searchterm ], offset = 80 , limit = 99 )
198+ FooBar .search ([searchterm ], offset = 80 , limit = 99 )[100 :400 :3 ]
198199 FooBar .search ([searchterm ], order = 'name ASC' )
200+ FooBar .search ([searchterm ], order = 'name ASC' )[:3 ]
201+ FooBar .search ([searchterm ], order = 'name ASC' )[40 :]
202+ FooBar .search ([searchterm ], order = 'name ASC' )[40 :99 ]
199203 FooBar .search (['name = mushroom' , 'state != draft' ])
200204 FooBar .search ([('name' , 'like' , 'Morice' )])
201205 FooBar .search ([])
@@ -207,15 +211,14 @@ def test_search(self):
207211
208212 FooBar .search ([searchterm ], limit = 2 ).ids
209213 FooBar .search ([searchterm ], offset = 80 , limit = 99 ).id
210- FooBar .search ([searchterm ], order = 'name ASC' )[:3 ]
211214 FooBar .search (['name = mushroom' , 'state != draft' ]) or 42
212215 FooBar .search ([('name' , 'like' , 'Morice' )]).ids
213216 FooBar ._execute ('search' , [('name like Morice' )])[0 ]
214217 FooBar .search ([]).ids
218+
215219 self .assertCalls (
216220 OBJ ('foo.bar' , 'search' , domain , 0 , 2 , None ),
217221 OBJ ('foo.bar' , 'search' , domain , 80 , 99 , None ),
218- OBJ ('foo.bar' , 'search' , domain , 0 , None , 'name ASC' ),
219222 OBJ ('foo.bar' , 'search' , domain2 ),
220223 OBJ ('foo.bar' , 'search' , domain ),
221224 OBJ ('foo.bar' , 'search' , domain ),
@@ -284,6 +287,25 @@ def test_search_count(self):
284287 self .assertCalls ()
285288 self .assertOutput ('' )
286289
290+ def test_search_read (self ):
291+ FooBar = self .env ['foo.bar' ]
292+ searchterm = 'name like Morice'
293+ domain = [('name' , 'like' , 'Morice' )]
294+
295+ FooBar .search ([searchterm ], order = 'name ASC' )[:3 ].name
296+
297+ expected_calls = [
298+ OBJ ('foo.bar' , 'fields_get' ),
299+ OBJ ('foo.bar' , 'search_read' , domain , ['name' ], order = 'name ASC' , limit = 3 ),
300+ ]
301+ if float (self .server_version ) < 8.0 :
302+ expected_calls [1 :2 ] = [
303+ OBJ ('foo.bar' , 'search' , domain , 0 , 3 , 'name ASC' ),
304+ OBJ ('foo.bar' , 'read' , [1001 , 1002 ], ['name' ]),
305+ ]
306+ self .assertCalls (* expected_calls )
307+ self .assertOutput ('' )
308+
287309 def test_read (self ):
288310 FooBar = self .env ['foo.bar' ]
289311
0 commit comments