[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
This commit is contained in:
Nicolas Martinelli
2017-03-23 14:45:54 +01:00
parent 71d86afb58
commit 0cfb7fc347
+6 -5
View File
@@ -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')