Odoo Help

0

0
2 Answers
1
Marius Stedjan
20.04.17, 21:29

You have some errors in your code.

View:

You want to loop (foreach) over all the products, with the name of each product as product.
See changes is bold:

<odoo>
<template id="index">
<t t-foreach="products" t-as="product">
<strong><t t-esc="product.id" /></strong>
<b><t t-esc="product.name" /></b>
</t>
</template>
</odoo>

Controller:

- You have to request the template with its full ID. 
- You don't have to import models and api. Just request the env with http.

Try : (Substitute "nameOfYourModule" with the actual name of your module ;) )

from openerp import http
class website_qty(http.Controller)      @http.route('/productos/', auth='public')
     def index(self, **kw):
        Products = http.request.env['product.product']         return http.request.render('nameOfYourModule.index', {
            'products': Products.search([])
        })
1 Comment
Bruno
20.04.17, 22:49

thank u so much

-1
Bruno
20.04.17, 22:48

 

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now