1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 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 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 General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ##############################################################################
24 from osv import fields
25 from tools.translate import _
27 class survey_print_answer(osv.osv_memory):
28 _name = 'survey.print.answer'
30 'response_ids' : fields.many2many('survey.response','survey_print_response','response_id','print_id', "Response", required="1"),
31 'orientation' : fields.selection([('vertical','Portrait(Vertical)'),('horizontal','Landscape(Horizontal)')], 'Orientation'),
32 'paper_size' : fields.selection([('letter','Letter (8.5" x 11")'),('legal','Legal (8.5" x 14")'),('a4','A4 (210mm x 297mm)')], 'Paper Size'),
33 'page_number' : fields.boolean('Include Page Numvers'),
34 'without_pagebreak' : fields.boolean('Print Without Page Breaks')
38 'orientation': lambda *a:'vertical',
39 'paper_size': lambda *a:'letter',
40 'page_number':lambda *a: 0,
41 'without_pagebreak':lambda *a: 0
44 def action_next(self, cr, uid, ids, context=None):
46 Print Survey Answer in pdf format.
48 @param self: The object pointer
49 @param cr: the current row, from the database cursor,
50 @param uid: the current user’s ID for security checks,
51 @param ids: List of print answer IDs
52 @param context: A standard dictionary for contextual values
53 @return : Dictionary value for created survey answer report
55 datas = {'ids' : context.get('active_ids', [])}
56 res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size', 'page_number', 'without_pagebreak'], context)
57 res = res and res[0] or {}
59 datas['model'] = 'survey.print.answer'
61 'type':'ir.actions.report.xml',
62 'report_name':'survey.browse.response',
67 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: