[FIX] [WIP] website_sale: fix crash when having product templates without variant.

probably it should not be displayed, but as there does not seem to exist any
clue about what the controller / view should do, I added some protections.

[DOC] added some comments because some methods seems quite weird.

bzr revid: tde@openerp.com-20131024110453-uj4xnrtwst0fdcrb
This commit is contained in:
Thibault Delavallée 2013-10-24 13:04:53 +02:00
parent 258846a697
commit 0467c8a5ab
3 changed files with 8 additions and 4 deletions

View File

@ -18,7 +18,7 @@ OpenERP E-Commerce
'security/website_sale.xml',
],
'demo': [
'website_sale_demo.xml',
# 'website_sale_demo.xml',
],
'qweb': ['static/src/xml/*.xml'],
'installable': True,

View File

@ -113,7 +113,7 @@ class Ecommerce(http.Controller):
request.context['pricelist'] = self.get_pricelist()
# search for checking of access rules and keep order
product_ids = [id for id in product_ids if id in product_obj.search(request.cr, request.uid, [("id", 'in', product_ids)], context=request.context)]
product_ids = product_obj.search(request.cr, request.uid, [("id", 'in', product_ids)], context=request.context)
size_ids = {}
style_ids = style_obj.search(request.cr, SUPERUSER_ID, [('html_class', 'like', 'size_%')], context=request.context)
@ -212,6 +212,7 @@ class Ecommerce(http.Controller):
col += 1
line += 1
print bin_packing_list
return bin_packing_list
def get_products(self, product_ids):
@ -272,6 +273,9 @@ class Ecommerce(http.Controller):
@website.route(['/shop/', '/shop/page/<int:page>/'], type='http', auth="public", multilang=True)
def category(self, category=0, attributes="", page=0, **post):
# TDE-NOTE: shouldn't we do somethign about product_template without variants ???
# TDE-NOTE: is there a reason to call a method category when the route is
# basically a shop without category_id speceified ?
if 'promo' in post:
self.change_pricelist(post.get('promo'))

View File

@ -43,7 +43,7 @@
<b t-field="product.name"/>
</a>
</div>
<div class="product_price">
<div class="product_price" t-if="product.product_variant_ids">
<b>
<t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
<del class="text-danger"
@ -285,7 +285,7 @@
<br/>
</t>
<div class="product_price mt16">
<div class="product_price mt16" t-if="product.product_variant_ids">
<h4>
<b><span class="oe_price" t-esc="product.product_variant_ids[0].price" /></b>