Note: This fw-port commit cherry-picked and squashed commit [2] directly
as it was fixing this original commit before it had the chance to
be forward ported.
Since commit [1], which adapted the website pages list view to OWL, the
records listed on screen are filtered according to the active website
filter. However, the full list of records is still used behind the
scenes for all potential actions.
Steps to reproduce:
1. Go to the pages list view.
2. Select a specific website (if it's not already the case).
=> The total of records in the upper right corner does not match the
number of pages on that specific website.
3. Click on the "Select all" checkbox.
=> All the pages are selected, including those that do not appear on
screen.
This is because the records were just visually hidden with a `t-if`.
[1]: https://github.com/odoo/odoo/commit/940f4ee875332dafa1f379970a7683be6b3ee606
[2]: https://github.com/odoo/odoo/commit/db670f64f4c2190f1655f9077ea62885049a3c84
Courtesy of @robinlej and @detrouxdev
Related to task-3676124
opw-3554064
opw-3658648
closes odoo/odoo#149547
X-original-commit: 8d78a916dc8c0eca82e8a6a2c6f5541938709930
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class TestModel(models.Model):
|
|
""" Add website option in server actions. """
|
|
|
|
_name = 'test.model'
|
|
_inherit = [
|
|
'website.seo.metadata',
|
|
'website.published.multi.mixin',
|
|
'website.searchable.mixin',
|
|
]
|
|
_description = 'Website Model Test'
|
|
|
|
name = fields.Char(required=True)
|
|
# `cascade` is needed as there is demo data for this model which are bound
|
|
# to website 2 (demo website). But some tests are unlinking the website 2,
|
|
# which would fail if the `cascade` is not set. Note that the website 2 is
|
|
# never set on any records in all other modules.
|
|
website_id = fields.Many2one('website', string='Website', ondelete='cascade')
|
|
|
|
@api.model
|
|
def _search_get_detail(self, website, order, options):
|
|
return {
|
|
'model': 'test.model',
|
|
'base_domain': [],
|
|
'search_fields': ['name'],
|
|
'fetch_fields': ['name'],
|
|
'mapping': {
|
|
'name': {'name': 'name', 'type': 'text', 'match': True},
|
|
'website_url': {'name': 'name', 'type': 'text', 'truncate': False},
|
|
},
|
|
'icon': 'fa-check-square-o',
|
|
'order': 'name asc, id desc',
|
|
}
|
|
|
|
|
|
class TestModelExposed(models.Model):
|
|
_name = "test.model.exposed"
|
|
_inherit = [
|
|
'website.seo.metadata',
|
|
'website.published.mixin',
|
|
]
|
|
_description = 'Website Model Test Exposed'
|
|
_rec_name = "name"
|
|
|
|
name = fields.Char()
|