mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_dashboard_tile : previous improvment introduced a regression due to the domain [('hidden', '=', False)] because it call the _compute_data for all the tiles, even if we want to display the tiles of a single category.
This commit is contained in:
@@ -40,13 +40,16 @@ class TileCategory(models.Model):
|
||||
|
||||
def _prepare_action(self):
|
||||
self.ensure_one()
|
||||
# Do not write domain [('hidden', '=', False)]
|
||||
# to avoid to call _compute_data on all tiles
|
||||
# see tile_tile.search()
|
||||
return {
|
||||
'name': self.name,
|
||||
'res_model': 'tile.tile',
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'kanban',
|
||||
'context': "{'no_hidden_tiles': True}",
|
||||
'domain': """[
|
||||
('hidden', '=', False),
|
||||
'|', ('user_id', '=', False), ('user_id', '=', uid),
|
||||
('category_id', '=', {self.id})
|
||||
]""".format(self=self),
|
||||
|
||||
@@ -185,6 +185,13 @@ class TileTile(models.Model):
|
||||
|
||||
error = fields.Char(string="Error Details", compute="_compute_data")
|
||||
|
||||
def search(self, args, offset=0, limit=None, order=None, count=False):
|
||||
res = super().search(args, offset=offset, limit=limit, order=order, count=count)
|
||||
if self.env.context.get("no_hidden_tiles", False):
|
||||
# late research on the hidden field.
|
||||
return res.filtered(lambda x: not x.hidden)
|
||||
return res
|
||||
|
||||
# Compute Section
|
||||
@api.depends("primary_format", "secondary_format", "model_id", "domain")
|
||||
def _compute_data(self):
|
||||
|
||||
Reference in New Issue
Block a user