コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
28615 ビュー

    @http.route(['/signage','/signage/list'],type='http', auth='user', website=True)
    def signage_list(self, **post):
        return request.render('signage.signage_list', {'signages': request.env['signage.signage'].search([('state','=','open')])})

ORDER BY! How do I write it Odoo style!?

アバター
破棄
最善の回答

Hi,

See a sample code of order done in the search method,

partner_sales = self.env['sale.order'].search([('partner_id','=', partner)], order="id desc")


In the above example the search method will return the result in the descending order of the id.


Thanks

アバター
破棄

note: if you use search_read, then you could try search_read(order="id desc")

著作者 最善の回答

Thank you! It's the same answer as I found myself, but I got the details mixed up... :-)
Another answer would be: <ul t-foreach="signages.sorted(lambda s: s.template_id)" t-as="signage">
but I like "order", the way you write!

アバター
破棄
関連投稿 返信 ビュー 活動
2
7月 25
4704
2
12月 24
7817
2
5月 24
7540
3
3月 24
6968
0
3月 24
1601