odoo/odoo#262947
Created by fw-bot
- label
- odoo-dev:saas-19.2-19.0-opw-6054059-newest_filter_big_number_variants-zavan-523785-fw
- head
- 47a4de30e2ab623742aa20193eea1666cf750d80
| odoo/odoo | |
|---|---|
| 19.0 | #260340 |
| saas-19.1 | #262941 |
| saas-19.2 | #262947 |
[FIX] website,website_sale: correct product carousel when a lot of variants
How to reproduce
- Create a Product with more than 256 variants
- Publish it to the website
- Go to the website and add a Product Carousel
- Set it to display newest products & hide variants
The problem
Fewer than 16 products are displayed
Cause
This issue was already adressed by this commit :
#195857
But because of limitations for specifically the "Newest Products" filter (cf. original commit message), the fix was only a workaround. Indeed, it increased the search limit to 256 before filtering out the variants, which caused problems when there was more than 256 variants.
But since then, big changes made in 19.0 has allowed us to implement a better fix : e3b062e5d3820
Proposed Solution
Since we can now pass the model in the options :
https://github.com/odoo/odoo/blob/b5069328734e623c12b0de50a177d501f7f0c995/addons/website/models/website_snippet_filter.py#L90
We give "product.template" when the hide_variants option is enabled and we filter on products. This allows use to remove the whole workaround that needed increase the limit on product searchs then getting their templates.
A recent commit blocks passing "product.template" since it does not have a dedicated snippet filter : #257208/changes/8e264ae4ea6ae16bbd410ac384733ff8759938a6
But in the commit message, they mention that this targets snippet in single-record mode, which is not our case. So, we move the logic to only be applied for single-record filters
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #260340