This question has been flagged
1 Reply
4446 Views

Suppose you'd like to display data from any existing model (custom or not).
How to search on the records you'd like to display? and how to show the values defined on this model ?

Avatar
Discard
Author Best Answer

Search and browse on the object using "request.registry", like this:

 <t t-set-='ids' t-value="request.registry['product.product'].search(request.cr, 1, [('website_published','=',True),('category_id.name','ilike','website')], request.context)">

<t t-set-='prods' t-value="request.registry['product.product'].browse(request.cr, request.uid, ids, request.context)">

           <t t-foreach="prods" t-as="prod" class="col28-set">
                        <span t-field="prod.image" t-field-options="{"widget": "image"}" class="img" />

                       <span t-field="prod.name"/>

           </t>

</t>

For the new API, use "request.env".

Avatar
Discard