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