Skip to content
Snippets Groups Projects
Commit 3457d1a7 authored by Romain Derie's avatar Romain Derie
Browse files

[FIX] website_sale_options: prevent other session crash after checkout

Check commit https://github.com/odoo/odoo/commit/ef48b81ab127dd717a4a9d106edd5c51121bc8f7

This commit is doing the same for website_sale_option as the optional product
is calling another route to add the product to the cart.
That route needed to be fixed too.

Closes #28209, related to #27508
parent e2afb075
No related branches found
No related tags found
No related merge requests found
......@@ -370,7 +370,7 @@ class WebsiteSale(http.Controller):
@http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True, csrf=False)
def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
sale_order = request.website.sale_get_order(force_create=1)
sale_order = request.website.sale_get_order(force_create=True)
if sale_order.state != 'draft':
request.session['sale_order_id'] = None
sale_order = request.website.sale_get_order(force_create=True)
......
......@@ -18,7 +18,10 @@ class WebsiteSaleOptions(WebsiteSale):
if lang:
request.website = request.website.with_context(lang=lang)
order = request.website.sale_get_order(force_create=1)
order = request.website.sale_get_order(force_create=True)
if order.state != 'draft':
request.session['sale_order_id'] = None
order = request.website.sale_get_order(force_create=True)
product = request.env['product.product'].browse(int(product_id))
option_ids = product.optional_product_ids.mapped('product_variant_ids').ids
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment