Files
odoo_source/addons/website_blog/data/blog_snippet_template_data.xml
T
qsm-odoo c7c0a6679e [FIX] website_blog, *: allow more than 6 blog posts in dynamic snippet
*: website

Commit [1] introduced the possibility to configure "website filters"
used in the website to display some records dynamically via the "dynamic
snippet" and its variants. One of their field is `limit` which is a max
number of records the filter allows to show (so that the client side
cannot ask for thousands of records). Users can configure the limit used
by a snippet via the editor: they are allowed to choose up to 16, still
safe-guarded by the internal limit configured on the website filter on
the python side.

The problem here was that [2] introduced website filters for the blog
posts but set up a max limit of 6. Thus breaking the editor option if
the user choose a limit between 7 and 16. This commit fixes the issue,
for newly configured snippets (as a stable fix) or for users who would
-u their blog application. EDIT: as the master version of this fix, all
blocks will now use their set limit. We consider that is an acceptable
change after migration that the user can change by himself if he wants
to.

Steps to reproduce:
- Install blog application
- Add a "Blog Posts" snippet
- Set "Fetched Elements" to 10 (there are 7 records in demo data)
=> Only 6 are still shown

[1]: https://github.com/odoo/odoo/commit/0e7640b5f22d2bea04bbe22d3189cff7e03af545
[2]: https://github.com/odoo/odoo/commit/3c0d98bcd8adf9325ee3497eb8d25ec7f904d6a5

opw-2885948

closes odoo/odoo#107179

X-original-commit: 3a3dc8729aa2beec49602fe4c141043f60effdf1
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-05 14:04:00 +01:00

36 lines
1.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Filters for Dynamic Filter -->
<record id="dynamic_snippet_latest_blog_post_filter" model="ir.filters">
<field name="name">Latest Blog Posts</field>
<field name="model_id">blog.post</field>
<field name="user_id" eval="False" />
<field name="domain">[('post_date', '&lt;=', context_today())]</field>
<field name="sort">['post_date desc']</field>
<field name="action_id" ref="website.action_website"/>
</record>
<record id="dynamic_snippet_most_viewed_blog_post_filter" model="ir.filters">
<field name="name">Most Viewed Blog Posts</field>
<field name="model_id">blog.post</field>
<field name="user_id" eval="False" />
<field name="domain">[('post_date', '&lt;=', context_today()), ('visits', '!=', False)]</field>
<field name="sort">['visits desc']</field>
<field name="action_id" ref="website.action_website"/>
</record>
<!-- Dynamic Filter -->
<record id="dynamic_filter_latest_blog_posts" model="website.snippet.filter">
<field name="name">Latest Blog Posts</field>
<field name="filter_id" ref="website_blog.dynamic_snippet_latest_blog_post_filter"/>
<field name="field_names">name,teaser,subtitle</field>
<field name="limit" eval="16"/>
</record>
<record id="dynamic_filter_most_viewed_blog_posts" model="website.snippet.filter">
<field name="name">Most Viewed Blog Posts</field>
<field name="filter_id" ref="website_blog.dynamic_snippet_most_viewed_blog_post_filter"/>
<field name="field_names">name,teaser,subtitle</field>
<field name="limit" eval="16"/>
</record>
</data>
</odoo>