From 892a7a7b9d5f4b03cd140568f1fa31c975565eef Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" <agr@odoo.com> Date: Tue, 21 Jan 2020 08:53:42 +0000 Subject: [PATCH] [FIX] website_sale_wishlist: fix pricelist assignation Steps to reproduce: - Install website_sale_wishlist,stock,sale_management,contacts - General Settings>Sales>Multiple Sales Prices per Product - Create or edit a product, assign 2 different prices in pricelists A and B - Publish it to the website - If your user is Mitchell Admin, go to its related res.partner, Sales & Purchases tab/Pricelist, choose pricelist B - Create a public user and assign it pricelist A - Go to the website/shop - Reach out the product and add to the wishlist When the current user is internal the product page will display price of B, but if you add the product to the wishlist, whishlist displays public price Same for the portal user. This happend because to avoid returning 500 when the product is unpublished c93f371d67def785f5b6d90f96eed8343e962203 the product is filtered using sudo() but the recordset is also returned with the sudo environment. Using it just to filter solve the issue opw-2166484 closes odoo/odoo#43646 X-original-commit: 4335f9dbf21447f717874b2d65552dd67c634df0 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> --- addons/website_sale_wishlist/models/product_wishlist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale_wishlist/models/product_wishlist.py b/addons/website_sale_wishlist/models/product_wishlist.py index 4914aae6ea21..72b2b7ffa55a 100644 --- a/addons/website_sale_wishlist/models/product_wishlist.py +++ b/addons/website_sale_wishlist/models/product_wishlist.py @@ -33,7 +33,7 @@ class ProductWishlist(models.Model): else: wish = self.search([("partner_id", "=", self.env.user.partner_id.id)]) - return wish.sudo().filtered('product_id.product_tmpl_id.website_published') + return wish.filtered(lambda x: x.sudo().product_id.product_tmpl_id.website_published) @api.model def _add_to_wishlist(self, pricelist_id, currency_id, website_id, price, product_id, partner_id=False): -- GitLab