[FIX] website_sale: removing invalid product from the cart
Reproduce the issue: - Install eCommerce app - Publish a product to your website - Add the product in your cart - Unpublish/make unsellable/archive the product The product is still in the cart and the checkout process can be done. Cause: There is no check for invalid products before displaying the cart This commit remove the invalid products while loading the cart. OPW-2092541 closes odoo/odoo#40241 X-original-commit: ab9290e39c2d2b9eb6d6f9972c1c8b546263edfd Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -404,6 +404,7 @@ class WebsiteSale(http.Controller):
|
||||
'suggested_products': [],
|
||||
})
|
||||
if order:
|
||||
order.order_line.filtered(lambda l: not l.product_id.active).unlink()
|
||||
_order = order
|
||||
if not request.env.context.get('pricelist'):
|
||||
_order = order.with_context(pricelist=order.pricelist_id.id)
|
||||
|
||||
Reference in New Issue
Block a user