From 0467c8a5abdeabacb90354a0a8ef936c317ba0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 24 Oct 2013 13:04:53 +0200 Subject: [PATCH] [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 --- addons/website_sale/__openerp__.py | 2 +- addons/website_sale/controllers/main.py | 6 +++++- addons/website_sale/views/website_sale.xml | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/website_sale/__openerp__.py b/addons/website_sale/__openerp__.py index 634078fe149..276bd11b0ff 100644 --- a/addons/website_sale/__openerp__.py +++ b/addons/website_sale/__openerp__.py @@ -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, diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 8de0a0bb578..193bb079191 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -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//'], 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')) diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index 26a484d247c..eb4c5fcf561 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -43,7 +43,7 @@ -
+
-
+

€