diff --git a/addons/web_livechat/publisher_warranty.py b/addons/web_livechat/publisher_warranty.py index 07f5430a136..ab83bc58c32 100644 --- a/addons/web_livechat/publisher_warranty.py +++ b/addons/web_livechat/publisher_warranty.py @@ -22,9 +22,21 @@ from osv import osv from tools import cache +def _gen_cache_clear(method): + def func(self, cr, *args, **kwargs): + s = super(publisher_warranty_contract, self) + r = getattr(s, method)(cr, *args, **kwargs) + self.is_livechat_enable.clear_cache(cr.dbname) + return r + return func + class publisher_warranty_contract(osv.osv): _inherit = 'publisher_warranty.contract' + create = _gen_cache_clear('create') + write = _gen_cache_clear('write') + unlink = _gen_cache_clear('unlink') + @cache(skiparg=3, timeout=300) def is_livechat_enable(self, cr, uid): domain = [('state', '=', 'valid'), ('check_support', '=', True)]