@@ -193,7 +193,11 @@ def test_search(self):
193193 self .assertIsInstance (FooBar .search ([searchterm ]), odooly .RecordList )
194194 FooBar .search ([searchterm ], limit = 2 )
195195 FooBar .search ([searchterm ], offset = 80 , limit = 99 )
196+ FooBar .search ([searchterm ], offset = 80 , limit = 99 )[100 :400 :3 ]
196197 FooBar .search ([searchterm ], order = 'name ASC' )
198+ FooBar .search ([searchterm ], order = 'name ASC' )[:3 ]
199+ FooBar .search ([searchterm ], order = 'name ASC' )[40 :]
200+ FooBar .search ([searchterm ], order = 'name ASC' )[40 :99 ]
197201 FooBar .search (['name = mushroom' , 'state != draft' ])
198202 FooBar .search ([('name' , 'like' , 'Morice' )])
199203 FooBar .search ([])
@@ -205,15 +209,14 @@ def test_search(self):
205209
206210 FooBar .search ([searchterm ], limit = 2 ).ids
207211 FooBar .search ([searchterm ], offset = 80 , limit = 99 ).id
208- FooBar .search ([searchterm ], order = 'name ASC' )[:3 ]
209212 FooBar .search (['name = mushroom' , 'state != draft' ]) or 42
210213 FooBar .search ([('name' , 'like' , 'Morice' )]).ids
211214 FooBar ._execute ('search' , [('name like Morice' )])[0 ]
212215 FooBar .search ([]).ids
216+
213217 self .assertCalls (
214218 OBJ ('foo.bar' , 'search' , domain , 0 , 2 , None ),
215219 OBJ ('foo.bar' , 'search' , domain , 80 , 99 , None ),
216- OBJ ('foo.bar' , 'search' , domain , 0 , None , 'name ASC' ),
217220 OBJ ('foo.bar' , 'search' , domain2 ),
218221 OBJ ('foo.bar' , 'search' , domain ),
219222 OBJ ('foo.bar' , 'search' , domain ),
@@ -282,6 +285,25 @@ def test_search_count(self):
282285 self .assertCalls ()
283286 self .assertOutput ('' )
284287
288+ def test_search_read (self ):
289+ FooBar = self .env ['foo.bar' ]
290+ searchterm = 'name like Morice'
291+ domain = [('name' , 'like' , 'Morice' )]
292+
293+ FooBar .search ([searchterm ], order = 'name ASC' )[:3 ].name
294+
295+ expected_calls = [
296+ OBJ ('foo.bar' , 'fields_get' ),
297+ OBJ ('foo.bar' , 'search_read' , domain , ['name' ], order = 'name ASC' , limit = 3 ),
298+ ]
299+ if float (self .server_version ) < 8.0 :
300+ expected_calls [1 :2 ] = [
301+ OBJ ('foo.bar' , 'search' , domain , 0 , 3 , 'name ASC' ),
302+ OBJ ('foo.bar' , 'read' , [1001 , 1002 ], ['name' ]),
303+ ]
304+ self .assertCalls (* expected_calls )
305+ self .assertOutput ('' )
306+
285307 def test_read (self ):
286308 FooBar = self .env ['foo.bar' ]
287309
0 commit comments