Odoo Help

Welcome!

This community 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.

0

How will I get values to the template?

By
Krishna
on 7/25/16, 6:53 AM 167 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

        cost_cp.append(data_cp) 

    _logger.error(cost_cp)

    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>--> 

        </t>

    </xpath>

</template>

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))"

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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