diff options
| author | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2020-09-15 15:04:39 +0000 |
|---|---|---|
| committer | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2020-09-16 11:33:45 +0000 |
| commit | bad5b6ef3581a7afebc8d93cf12cafb3e27eef0d (patch) | |
| tree | b40c438243dca471ae91ace32b3fbab8a01b98b2 /addons/website_sale/controllers/main.py | |
| parent | 10b996379855f44c95a225b52ffa168cb77273e2 (diff) | |
[FIX] website_sale: unpublished recently viewed cause access error
1. Login as admin
2. Go to any product page and click Personalize > Enable recently viewed
products
3. Login in another browser session as portal user
4. Open some products until you start seeing the recently viewed
products
5. With the admin account unpublish one of the recently viewed
6. On the portal account browse more to display the recently viewed
Access error will raise because an unpublished product is requested by
the user.
Filtering the product to allow only published products fix the issue.
opw-2336699
closes odoo/odoo#57833
X-original-commit: 668778125c2d4231d9b48456c3397edb8d04acb3
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/website_sale/controllers/main.py')
| -rw-r--r-- | addons/website_sale/controllers/main.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 49ec6300129..9def3846bbc 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -1214,7 +1214,7 @@ class WebsiteSale(http.Controller): if visitor: excluded_products = request.website.sale_get_order().mapped('order_line.product_id.id') products = request.env['website.track'].sudo().read_group( - [('visitor_id', '=', visitor.id), ('product_id', '!=', False), ('product_id', 'not in', excluded_products)], + [('visitor_id', '=', visitor.id), ('product_id', '!=', False), ('product_id.website_published', '=', True), ('product_id', 'not in', excluded_products)], ['product_id', 'visit_datetime:max'], ['product_id'], limit=max_number_of_product_for_carousel, orderby='visit_datetime DESC') products_ids = [product['product_id'][0] for product in products] if products_ids: |
