Openerp 在环境odoo中选择“顶部,随机”

Openerp 在环境odoo中选择“顶部,随机”,openerp,odoo-9,Openerp,Odoo 9,是否可以在请求环境中添加“选择顶部”和“radndom”选项 我不需要返回数据库中的所有数据,只返回前10名。您可以尝试搜索参数limit,(如果需要,order参数) test=http.request.env['my.test'].sudo().search([('type','=',1)],limit=10) test = http.request.env['my.test'].sudo().search([('type','=',1)])[0] return http.

是否可以在请求环境中添加“选择顶部”和“radndom”选项


我不需要返回数据库中的所有数据,只返回前10名。

您可以尝试搜索参数limit,(如果需要,order参数)

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

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

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