[FIX] web_livechat: clear cache at create/write/unlink
bzr revid: chs@openerp.com-20110117193234-6ywxa2dcian1l0wl
This commit is contained in:
parent
1b7230e2e5
commit
61bafa269f
|
@ -22,9 +22,21 @@
|
||||||
from osv import osv
|
from osv import osv
|
||||||
from tools import cache
|
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):
|
class publisher_warranty_contract(osv.osv):
|
||||||
_inherit = 'publisher_warranty.contract'
|
_inherit = 'publisher_warranty.contract'
|
||||||
|
|
||||||
|
create = _gen_cache_clear('create')
|
||||||
|
write = _gen_cache_clear('write')
|
||||||
|
unlink = _gen_cache_clear('unlink')
|
||||||
|
|
||||||
@cache(skiparg=3, timeout=300)
|
@cache(skiparg=3, timeout=300)
|
||||||
def is_livechat_enable(self, cr, uid):
|
def is_livechat_enable(self, cr, uid):
|
||||||
domain = [('state', '=', 'valid'), ('check_support', '=', True)]
|
domain = [('state', '=', 'valid'), ('check_support', '=', True)]
|
||||||
|
|
Loading…
Reference in New Issue