[FIX] website: show homepage in page list when multi website is disabled

Since website was moved from frontend to backend in 16.0 with [1], there
was an issue with the page list view which would not show the homepage
record when multi website group was not enabled.

Indeed, we have our own `recordFilter` method which is based on the
`website_id` field.
But the framework ignore this field (it doesn't read the property at all
and so don't have access to its value) if it's hidden by a `groups`
property. In such cases, the field should be duplicated and hidden with
`invisible`, as those fields will have their value retrieved depsite
being hidden.

Step to reproduce:
- Install website with no demo data (to have only one website)
  Or go to runbot / install website with demo data and disable the multi
  website group
- Go to Website > Site > Pages
- You don't see the homepage in the list, because there is 2 homepage
  (one specific and one generic) but since the website_id is not fetch,
  both are considered generic (which is not supposed to be possible)
  and the filter is then considering those to be shadowed by the other,
  ultimately filtering out both.

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

closes odoo/odoo#112461

X-original-commit: 5ff5daee518d23c3b6958133eb1f99bc5fc1063f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Romain Derie
2023-02-11 19:20:56 +01:00
parent b79863a62e
commit ba42f2dda9
@@ -79,7 +79,13 @@
<field name="write_date" optional="hide"/>
<field name="track" optional="hide"/>
<!-- website_id should be shown only in multi website environment
when the group is enabled, but we need the field to be there all the
time for `PageRendererMixin`'s `recordFilter' to be able to filter
correctly. -->
<field name="website_id" invisible="1"/>
<field name="website_id" groups="website.group_multi_website"/>
<button name="action_page_debug_view" type="object" title="Settings" icon="fa-bug fa-lg" groups="base.group_no_one"/>
</tree>
</field>