[FIX] website_sale_wishlist: Product with sale_ok = False in wishlist

Steps to reproduce the bug:

- Let's consider a sellable product P published on the shop
- Let's consider a portal user PU adding P in his wishlist W
- Set P with sale_ok = False (meaning unsellable)
- With PU try to see W

Bug:

A 430 error was raised because the product P was not sellable

opw:2362184

closes odoo/odoo#60540

X-original-commit: 8646b0049808036422fec200163a8a4ff1d0df43
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-10-22 13:30:03 +00:00
parent f55639dfac
commit f458ffe5f6
@@ -33,7 +33,7 @@ class ProductWishlist(models.Model):
else:
wish = self.search([("partner_id", "=", self.env.user.partner_id.id), ('website_id', '=', request.website.id)])
return wish.filtered(lambda x: x.sudo().product_id.product_tmpl_id.website_published)
return wish.filtered(lambda x: x.sudo().product_id.product_tmpl_id.website_published and x.sudo().product_id.product_tmpl_id.sale_ok)
@api.model
def _add_to_wishlist(self, pricelist_id, currency_id, website_id, price, product_id, partner_id=False):