1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ##############################################################################
26 def _open_history_event(self, cr, uid, data, context=None):
27 pool = pooler.get_pool(cr.dbname)
28 data_obj = pool.get('ir.model.data')
29 result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_filter')
30 id = data_obj.read(cr, uid, result, ['res_id'])
31 id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_section-view')
33 id2 = data_obj.browse(cr, uid, id2, context=context).res_id
35 if data.get('model',False) and data.get('ids',False):
36 model_obj = pooler.get_pool(cr.dbname).get(data['model'])
37 res = model_obj.browse(cr, uid, data['ids'], context=context)
41 'name': 'History : ' + res,
43 "view_mode": 'calendar, tree, form',
45 'views': [(id2,'calendar'),(False,'form'),(False,'tree'),(False,'graph')],
46 'res_model': 'crm.case',
47 'type': 'ir.actions.act_window',
48 'domain': data.get('id',False) and "[('case_id','=',%d)]" % (data['id']) or "[]",
49 'search_view_id': id['res_id']
52 class case_history_event(wizard.interface):
56 'result': {'type': 'action', 'action': _open_history_event, 'state':'end'}
60 case_history_event('crm.case.history.events')