2010-03-22 07:40:07 +00:00
|
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
|
##############################################################################
|
|
|
|
|
#
|
|
|
|
|
# OpenERP, Open Source Management Solution
|
2010-12-08 13:59:16 +00:00
|
|
|
|
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
|
2010-03-22 07:40:07 +00:00
|
|
|
|
#
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2010-12-08 13:59:16 +00:00
|
|
|
|
# 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.
|
2010-03-22 07:40:07 +00:00
|
|
|
|
#
|
|
|
|
|
# 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
|
2010-12-08 13:59:16 +00:00
|
|
|
|
# GNU Affero General Public License for more details.
|
2010-03-22 07:40:07 +00:00
|
|
|
|
#
|
2010-12-08 13:59:16 +00:00
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-03-22 07:40:07 +00:00
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
#
|
|
|
|
|
##############################################################################
|
|
|
|
|
|
2010-03-23 05:23:09 +00:00
|
|
|
|
from osv import osv
|
|
|
|
|
from osv import fields
|
2010-03-22 07:40:07 +00:00
|
|
|
|
from tools.translate import _
|
|
|
|
|
|
|
|
|
|
class survey_print_answer(osv.osv_memory):
|
|
|
|
|
_name = 'survey.print.answer'
|
|
|
|
|
_columns = {
|
2010-03-26 13:27:16 +00:00
|
|
|
|
'response_ids': fields.many2many('survey.response','survey_print_response',\
|
2010-04-05 11:59:01 +00:00
|
|
|
|
'response_id','print_id', "Answer", required="1"),
|
2010-03-26 13:27:16 +00:00
|
|
|
|
'orientation': fields.selection([('vertical','Portrait(Vertical)'),\
|
|
|
|
|
('horizontal','Landscape(Horizontal)')], 'Orientation'),
|
|
|
|
|
'paper_size': fields.selection([('letter','Letter (8.5" x 11")'),\
|
|
|
|
|
('legal','Legal (8.5" x 14")'),\
|
|
|
|
|
('a4','A4 (210mm x 297mm)')], 'Paper Size'),
|
2010-07-13 09:58:07 +00:00
|
|
|
|
'page_number': fields.boolean('Include Page Number'),
|
2010-03-26 13:27:16 +00:00
|
|
|
|
'without_pagebreak': fields.boolean('Print Without Page Breaks')
|
2010-03-22 07:40:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_defaults = {
|
2010-08-13 12:20:05 +00:00
|
|
|
|
'orientation': lambda *a:'vertical',
|
|
|
|
|
'paper_size': lambda *a:'letter',
|
|
|
|
|
'page_number': lambda *a: 0,
|
|
|
|
|
'without_pagebreak': lambda *a: 0
|
2010-03-22 07:40:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def action_next(self, cr, uid, ids, context=None):
|
2010-03-22 11:08:02 +00:00
|
|
|
|
"""
|
2010-03-22 12:36:17 +00:00
|
|
|
|
Print Survey Answer in pdf format.
|
2010-03-26 13:27:16 +00:00
|
|
|
|
|
2010-03-22 12:36:17 +00:00
|
|
|
|
@param self: The object pointer
|
|
|
|
|
@param cr: the current row, from the database cursor,
|
|
|
|
|
@param uid: the current user’s ID for security checks,
|
|
|
|
|
@param ids: List of print answer IDs
|
|
|
|
|
@param context: A standard dictionary for contextual values
|
|
|
|
|
@return : Dictionary value for created survey answer report
|
2010-03-22 11:08:02 +00:00
|
|
|
|
"""
|
2010-11-23 07:05:05 +00:00
|
|
|
|
if context is None:
|
2010-11-22 10:37:53 +00:00
|
|
|
|
context = {}
|
2010-03-26 13:27:16 +00:00
|
|
|
|
datas = {'ids': context.get('active_ids', [])}
|
|
|
|
|
res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size',\
|
2011-02-15 10:55:09 +00:00
|
|
|
|
'page_number', 'without_pagebreak'], context=context)
|
2010-03-26 13:27:16 +00:00
|
|
|
|
res = res and res[0] or {}
|
2010-03-22 07:40:07 +00:00
|
|
|
|
datas['form'] = res
|
|
|
|
|
datas['model'] = 'survey.print.answer'
|
2010-03-26 13:27:16 +00:00
|
|
|
|
return {
|
|
|
|
|
'type': 'ir.actions.report.xml',
|
|
|
|
|
'report_name': 'survey.browse.response',
|
|
|
|
|
'datas': datas,
|
2010-03-22 12:36:17 +00:00
|
|
|
|
}
|
2010-03-26 13:27:16 +00:00
|
|
|
|
|
2010-03-22 07:40:07 +00:00
|
|
|
|
survey_print_answer()
|
|
|
|
|
|
2010-03-22 12:36:17 +00:00
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|