1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
23 from osv import fields
25 class survey_browse_answer(osv.osv_memory):
26 _name = 'survey.browse.answer'
29 'survey_id': fields.many2one('survey', "Survey", required="1"),
30 'response_id': fields.many2one("survey.response", "Survey Answers", help="If this field is empty, all answers of the selected survey will be print."),
33 def action_next(self, cr, uid, ids, context=None):
35 Open Browse Response wizard. if you select only survey_id then this wizard open with all response_ids and
36 if you select survey_id and response_id then open the particular response of the survey.
38 if context is None: context = {}
39 record = self.read(cr, uid, ids, [])
40 record = record and record[0] or {}
41 if record['response_id']:
42 res_id = [(record.get('response_id') and record['response_id'][0])]
44 sur_response_obj = self.pool.get('survey.response')
45 res_id = sur_response_obj.search(cr, uid, [('survey_id', '=', record['survey_id'][0])])
46 context.update({'active' : True,'survey_id' : record['survey_id'][0], 'response_id' : res_id, 'response_no' : 0})
47 search_obj = self.pool.get('ir.ui.view')
48 search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
52 'res_model': 'survey.question.wiz',
53 'type': 'ir.actions.act_window',
55 'search_view_id':search_id[0],
59 survey_browse_answer()
61 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: