From 0cfb7fc347a26302e950e1cab6123b9754fddab7 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 23 Mar 2017 14:14:04 +0100 Subject: [PATCH] [FIX] website_sale: redirect if no order - Visit the webshop without being logged in, do not put anything in the cart. - Visit the URL /shop/address - An expty SO is created opw-725277 --- addons/website_sale/controllers/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index ce5bcec9615..2d4d64a6b31 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -532,17 +532,18 @@ class WebsiteSale(http.Controller): @http.route(['/shop/address'], type='http', methods=['GET', 'POST'], auth="public", website=True) def address(self, **kw): Partner = request.env['res.partner'].with_context(show_address=1).sudo() - order = request.website.sale_get_order(force_create=1) + order = request.website.sale_get_order() + + redirection = self.checkout_redirection(order) + if redirection: + return redirection + mode = (False, False) def_country_id = order.partner_id.country_id values, errors = {}, {} partner_id = int(kw.get('partner_id', -1)) - redirection = self.checkout_redirection(order) - if redirection: - return redirection - # IF PUBLIC ORDER if order.partner_id.id == request.website.user_id.sudo().partner_id.id: mode = ('new', 'billing')