1
votes

Is it possible in request env add "Select top" and "radndom" option?

test = http.request.env['my.test'].sudo().search([('type','=',1)])[0]

        return http.request.render('my_page', {'test': test})

I don't need return all data from database only top 10.

1

1 Answers

1
votes

You can try parameter limit, (and order parameter if needed) of search.

test = http.request.env['my.test'].sudo().search([('type','=',1)], limit=10)