Odoo Help


How will I get values to the template?

on 7/25/16, 6:53 AM 576 views

@http.route('/shop',auth='public', website=True)

def user_type(self):

    if request.env.user.premium_user == True:

    cPrice = request.env['product.template'].search([('id','!=',False)])

    cost_cp = []

    for pdt in cPrice:

        data_cp = pdt.standard_price



    return http.request.render('shopping_cart.usertype',{'costSP':cost_cp})

else :

    return request.render['sale.order'].browse('product.price')

This is my python code and I'll get the correct result in here.

<template id="usertype" inherit_id="website_sale.products_item" name="Products item standard">

    <xpath expr="//span[@itemprop='price']" position="replace"> 

        <t t-foreach= "costSP" t-as="cp">

           <!-- <p><a t-attf-href="/shop/{{ slug(cp) }}">-->

        <span itemprop="price" style="display:none;" t-esc="cp"/>

        <span itemprop="priceCurrency" style="display:none;" t-esc="website.currency_id.name"/>

       <!-- </a></p>--> 




This is my template and I'll get the following error. But the cost_cp having values which I didnt get in template.

"'NoneType' object is not iterable" while evaluating
"keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))"

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/25/16, 6:53 AM
Seen: 576 times
Last updated: 7/25/16, 7:00 AM