@@ -187,7 +187,11 @@ def test_search(self):
187187 self .assertIsInstance (FooBar .search ([searchterm ]), odooly .RecordList )
188188 FooBar .search ([searchterm ], limit = 2 )
189189 FooBar .search ([searchterm ], offset = 80 , limit = 99 )
190+ FooBar .search ([searchterm ], offset = 80 , limit = 99 )[100 :400 :3 ]
190191 FooBar .search ([searchterm ], order = 'name ASC' )
192+ FooBar .search ([searchterm ], order = 'name ASC' )[:3 ]
193+ FooBar .search ([searchterm ], order = 'name ASC' )[40 :]
194+ FooBar .search ([searchterm ], order = 'name ASC' )[40 :99 ]
191195 FooBar .search (['name = mushroom' , 'state != draft' ])
192196 FooBar .search ([('name' , 'like' , 'Morice' )])
193197 FooBar .search ([])
@@ -199,15 +203,14 @@ def test_search(self):
199203
200204 FooBar .search ([searchterm ], limit = 2 ).ids
201205 FooBar .search ([searchterm ], offset = 80 , limit = 99 ).id
202- FooBar .search ([searchterm ], order = 'name ASC' )[:3 ]
203206 FooBar .search (['name = mushroom' , 'state != draft' ]) or 42
204207 FooBar .search ([('name' , 'like' , 'Morice' )]).ids
205208 FooBar ._execute ('search' , [('name like Morice' )])[0 ]
206209 FooBar .search ([]).ids
210+
207211 self .assertCalls (
208212 OBJ ('foo.bar' , 'search' , domain , 0 , 2 , None ),
209213 OBJ ('foo.bar' , 'search' , domain , 80 , 99 , None ),
210- OBJ ('foo.bar' , 'search' , domain , 0 , None , 'name ASC' ),
211214 OBJ ('foo.bar' , 'search' , domain2 ),
212215 OBJ ('foo.bar' , 'search' , domain ),
213216 OBJ ('foo.bar' , 'search' , domain ),
@@ -276,6 +279,25 @@ def test_search_count(self):
276279 self .assertCalls ()
277280 self .assertOutput ('' )
278281
282+ def test_search_read (self ):
283+ FooBar = self .env ['foo.bar' ]
284+ searchterm = 'name like Morice'
285+ domain = [('name' , 'like' , 'Morice' )]
286+
287+ FooBar .search ([searchterm ], order = 'name ASC' )[:3 ].name
288+
289+ expected_calls = [
290+ OBJ ('foo.bar' , 'fields_get' ),
291+ OBJ ('foo.bar' , 'search_read' , domain , ['name' ], order = 'name ASC' , limit = 3 ),
292+ ]
293+ if float (self .server_version ) < 8.0 :
294+ expected_calls [1 :2 ] = [
295+ OBJ ('foo.bar' , 'search' , domain , 0 , 3 , 'name ASC' ),
296+ OBJ ('foo.bar' , 'read' , [1001 , 1002 ], ['name' ]),
297+ ]
298+ self .assertCalls (* expected_calls )
299+ self .assertOutput ('' )
300+
279301 def test_read (self ):
280302 FooBar = self .env ['foo.bar' ]
281303
0 commit comments