Clear view caches when dashboard fields of user are modified

Closes #13662
(grafted from 23916deaf57fd2fcf7a35deec337fb9a8e479bec)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2024-11-06 17:57:35 +01:00
parent ec40d22eaf
commit 789a515b9e
+13 -2
View File
@@ -1,7 +1,7 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.model import ModelView, fields
from trytond.pool import Pool, PoolMeta
class User(metaclass=PoolMeta):
@@ -27,3 +27,14 @@ class User(metaclass=PoolMeta):
@staticmethod
def default_dashboard_layout():
return 'square'
@classmethod
def write(cls, *args):
pool = Pool()
View = pool.get('ir.ui.view')
super().write(*args)
for values in args[1:None:2]:
if values.keys() & {'dashboard_layout', 'dashboard_actions'}:
View._view_get_cache.clear()
ModelView._fields_view_get_cache.clear()
break