2010-12-14 15:24:03 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
2011-01-10 10:06:28 +00:00
|
|
|
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
|
2010-12-14 15:24:03 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
from osv import osv
|
|
|
|
from tools import cache
|
|
|
|
|
2011-01-17 19:32:34 +00:00
|
|
|
def _gen_cache_clear(method):
|
|
|
|
def func(self, cr, *args, **kwargs):
|
|
|
|
s = super(publisher_warranty_contract, self)
|
|
|
|
r = getattr(s, method)(cr, *args, **kwargs)
|
2011-12-06 15:47:39 +00:00
|
|
|
self.is_livechat_enable.clear_cache(self)
|
2011-01-17 19:32:34 +00:00
|
|
|
return r
|
|
|
|
return func
|
|
|
|
|
2010-12-14 15:24:03 +00:00
|
|
|
class publisher_warranty_contract(osv.osv):
|
|
|
|
_inherit = 'publisher_warranty.contract'
|
|
|
|
|
2011-01-17 19:32:34 +00:00
|
|
|
create = _gen_cache_clear('create')
|
|
|
|
write = _gen_cache_clear('write')
|
|
|
|
unlink = _gen_cache_clear('unlink')
|
|
|
|
|
2010-12-14 15:24:03 +00:00
|
|
|
@cache(skiparg=3, timeout=300)
|
|
|
|
def is_livechat_enable(self, cr, uid):
|
2011-01-17 15:24:35 +00:00
|
|
|
domain = [('state', '=', 'valid'), ('check_support', '=', True)]
|
2010-12-14 15:24:03 +00:00
|
|
|
return self.search_count(cr, uid, domain) != 0
|
|
|
|
|
|
|
|
@cache(skiparg=3)
|
|
|
|
def get_default_livechat_text(self, cr, uid):
|
2011-12-09 16:35:22 +00:00
|
|
|
return '<a href="#" target="_blank"><img src="/web_livechat/static/src/img/busy.png"/>Support</a>'
|
2010-12-14 15:24:03 +00:00
|
|
|
|
|
|
|
publisher_warranty_contract()
|
|
|
|
|
2011-11-22 08:51:38 +00:00
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|