[IMP] survey :- convert simple wizard(survey_print) to osv_memory wizard, and add comment.
bzr revid: ysa@tinyerp.co.in-20100322110802-u42cr2vuqcewe7z2
This commit is contained in:
parent
1b29ee4ddc
commit
4b4b4476ed
|
@ -41,7 +41,8 @@
|
|||
'security/ir.model.access.csv',
|
||||
'wizard/survey_print_statistics.xml',
|
||||
'wizard/survey_print_answer.xml',
|
||||
'wizard/survey_browse_answer.xml'],
|
||||
'wizard/survey_browse_answer.xml',
|
||||
'wizard/survey_print.xml'],
|
||||
'demo_xml': ['survey_demo.xml'],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -243,8 +243,6 @@
|
|||
string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
|
||||
<button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
|
||||
string="Edit Survey" type="action" icon="gtk-edit" context="{'active':True,'edit' : True,'survey_id': active_id}"/>
|
||||
<button name="%(wizard_print_survey)d" states="open,draft,close,cancel"
|
||||
string="Print Survey" type="action" icon="gtk-print" context="{'active':True,'survey_id': active_id}"/>
|
||||
<button name="%(survey_browse_response)d" states="open,draft,close,cancel"
|
||||
string="Print Answer" type="action" icon="gtk-print"/>
|
||||
</tree>
|
||||
|
|
|
@ -5,8 +5,5 @@
|
|||
<wizard string="Send Invitation" id="wizard_send_invitation"
|
||||
model="survey" name="wizard.send.invitation"/>
|
||||
|
||||
<wizard string="Print Survey" id="wizard_print_survey"
|
||||
model="survey" name="wizard.print.survey"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
##############################################################################
|
||||
|
||||
import wizard_survey
|
||||
import wizard_print_survey
|
||||
import survey_print_statistics
|
||||
import survey_print_answer
|
||||
import survey_browse_answer
|
||||
import survey_selection
|
||||
import survey_answer
|
||||
import survey_print
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -36,6 +36,17 @@ class survey_question_wiz(osv.osv_memory):
|
|||
'name': fields.integer('Number'),
|
||||
}
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
|
||||
"""
|
||||
Fields View Get method :- generate the new view and display the survey pages of selected survey.
|
||||
|
||||
@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 view_id : view id of the current object.
|
||||
@param view_type : which type of view is create. like :- form, tree ,search etc...
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for created view of particular survey pages.
|
||||
"""
|
||||
result = super(survey_question_wiz, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
surv_name_wiz = self.pool.get('survey.name.wiz')
|
||||
survey_obj = self.pool.get('survey')
|
||||
|
@ -401,6 +412,18 @@ class survey_question_wiz(osv.osv_memory):
|
|||
return result
|
||||
|
||||
def create_report(self, cr, uid, res_ids, report_name=False, file_name=False, context=None):
|
||||
"""
|
||||
If any user give answer of survey then last create report of this answer and if 'E-mail Notification on Response' set True in survey then send mail on responsible person of this survey and attach survey answer report in pdf format.
|
||||
|
||||
@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 res_ids: List of survey answer IDs,
|
||||
@param report_name: name of the report,
|
||||
@param file_name: To give file name of the report,
|
||||
@param context: A standard dictionary for contextual values,
|
||||
@return : Dictionary value for created report with file name.
|
||||
"""
|
||||
if not report_name or not res_ids:
|
||||
return (False, Exception('Report name and Resources ids are required !!!'))
|
||||
try:
|
||||
|
@ -418,6 +441,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
return (True, ret_file_name)
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
"""
|
||||
Assign Default value in particular field. If Browse Answers wizard run then read the value into database and Assigne to a particular fields.
|
||||
|
||||
@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 fields_list: List of fields of current view,
|
||||
@param context: A standard dictionary for contextual values,
|
||||
@return : Dictionary value for fields list with value.
|
||||
"""
|
||||
value = {}
|
||||
for field in fields_list:
|
||||
if field.split('_')[0] == 'progress':
|
||||
|
@ -488,6 +521,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
return value
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
"""
|
||||
Create the Answer of survey and store in survey.response object, and if set validation of question then check the value of question if value is wrong then raise the exception.
|
||||
|
||||
@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 vals: Values,
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : True.
|
||||
"""
|
||||
if context.has_key('active') and context.get('active',False):
|
||||
return True
|
||||
|
||||
|
@ -719,7 +762,7 @@ class survey_question_wiz(osv.osv_memory):
|
|||
if not select_count:
|
||||
resp_obj.write(cr, uid, resp_id, {'state':'skip'})
|
||||
|
||||
if que_rec['numeric_required_sum'] and numeric_sum > que_rec['numeric_required_sum']:
|
||||
if que_rec[also'numeric_required_sum'] and numeric_sum > que_rec['numeric_required_sum']:
|
||||
for res in resp_id_list:
|
||||
sur_name_read['store_ans'].pop(res)
|
||||
raise osv.except_osv(_('Error re !'), _("'" + que_rec['question'] + "' " + tools.ustr(que_rec['numeric_required_sum_err_msg'])))
|
||||
|
@ -936,6 +979,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
return True
|
||||
|
||||
def action_new_question(self,cr, uid, ids, context):
|
||||
"""
|
||||
New survey.Question form.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open new survey.Qestion form.
|
||||
"""
|
||||
for key,val in context.items():
|
||||
if type(key) == type(True):
|
||||
context.pop(key)
|
||||
|
@ -951,6 +1004,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_new_page(self, cr, uid, ids, context):
|
||||
"""
|
||||
New survey.Page form.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open new survey.page form.
|
||||
"""
|
||||
for key,val in context.items():
|
||||
if type(key) == type(True):
|
||||
context.pop(key)
|
||||
|
@ -966,6 +1029,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_edit_page(self,cr, uid, ids, context):
|
||||
"""
|
||||
Edit survey.page.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open Edit survey.page form.
|
||||
"""
|
||||
for key,val in context.items():
|
||||
if type(key) == type(True):
|
||||
context.pop(key)
|
||||
|
@ -982,6 +1055,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_delete_page(self,cr, uid, ids, context):
|
||||
"""
|
||||
Delete survey.page.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open next survey.page form, but delete the selected page.
|
||||
"""
|
||||
for key,val in context.items():
|
||||
if type(key) == type(True):
|
||||
context.pop(key)
|
||||
|
@ -1001,6 +1084,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_edit_question(self,cr, uid, ids, context):
|
||||
"""
|
||||
Edit survey.question.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open Edit survey.question form.
|
||||
"""
|
||||
for key,val in context.items():
|
||||
if type(key) == type(True):
|
||||
context.pop(key)
|
||||
|
@ -1017,6 +1110,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_delete_question(self,cr, uid, ids, context):
|
||||
"""
|
||||
Edit survey.question.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open same survey.page form, but delete the selected survey.question in current survey.page.
|
||||
"""
|
||||
for key,val in context.items():
|
||||
if type(key) == type(True):
|
||||
context.pop(key)
|
||||
|
@ -1037,6 +1140,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_forward_previous(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Goes to previous Survey Answer.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open Previous Answer form.
|
||||
"""
|
||||
search_obj = self.pool.get('ir.ui.view')
|
||||
surv_name_wiz = self.pool.get('survey.name.wiz')
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
|
@ -1056,6 +1169,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_forward_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Goes to Next Survey Answer.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open Next Answer form.
|
||||
"""
|
||||
search_obj = self.pool.get('ir.ui.view')
|
||||
surv_name_wiz = self.pool.get('survey.name.wiz')
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
|
@ -1075,6 +1198,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Goes to Next page.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open Next survey.page form.
|
||||
"""
|
||||
surv_name_wiz = self.pool.get('survey.name.wiz')
|
||||
search_obj = self.pool.get('ir.ui.view')
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
|
@ -1090,6 +1223,16 @@ class survey_question_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_previous(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Goes to previous page.
|
||||
|
||||
@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 survey.question.wiz IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for Open Previous survey.page form.
|
||||
"""
|
||||
surv_name_wiz = self.pool.get('survey.name.wiz')
|
||||
search_obj = self.pool.get('ir.ui.view')
|
||||
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
|
||||
|
@ -1106,5 +1249,4 @@ class survey_question_wiz(osv.osv_memory):
|
|||
|
||||
survey_question_wiz()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -26,8 +26,15 @@ from tools.translate import _
|
|||
|
||||
class survey_browse_answer(osv.osv_memory):
|
||||
_name = 'survey.browse.answer'
|
||||
|
||||
def _get_survey(self, cr, uid, context=None):
|
||||
"""
|
||||
Set the value in survey_id field,
|
||||
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param context: A standard dictionary for contextual values,
|
||||
@return : Tuple in list with values.
|
||||
"""
|
||||
surv_obj = self.pool.get("survey")
|
||||
surv_resp_obj = self.pool.get("survey.response")
|
||||
result = []
|
||||
|
@ -42,6 +49,16 @@ class survey_browse_answer(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Open Browse Response wizard. if you select only survey_id then this wizard open with all response_ids and if you select survey_id and response_id then open the particular response of the survey.
|
||||
|
||||
@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 survey.browse.answer IDs,
|
||||
@param context: A standard dictionary for contextual values,
|
||||
@return : Dictionary value for Open the browse answer wizard.
|
||||
"""
|
||||
record = self.read(cr, uid, ids, [])
|
||||
record = record and record[0] or {}
|
||||
if record['response_id']:
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class survey_print(osv.osv_memory):
|
||||
_name = 'survey.print'
|
||||
_columns = {
|
||||
'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'),
|
||||
'survey_title' : fields.boolean('Include Survey Title'),
|
||||
'page_number' : fields.boolean('Include Page Numvers'),
|
||||
'without_pagebreak' : fields.boolean('Print Without Page Breaks'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'orientation': lambda *a:'vertical',
|
||||
'paper_size': lambda *a:'letter',
|
||||
'survey_title':lambda *a: 0,
|
||||
'page_number':lambda *a: 0,
|
||||
'without_pagebreak':lambda *a: 0
|
||||
}
|
||||
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Print Survey Form(print template of the survey).
|
||||
|
||||
@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 Survey IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for print survey form.
|
||||
"""
|
||||
datas = {'ids' : context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size', 'page_number', 'without_pagebreak'], context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print'
|
||||
return {
|
||||
'type':'ir.actions.report.xml',
|
||||
'report_name':'survey.form',
|
||||
'datas':datas,
|
||||
}
|
||||
|
||||
survey_print()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Survey Print Form View -->
|
||||
|
||||
<record id="view_survey_print" model="ir.ui.view">
|
||||
<field name="name">Survey Print</field>
|
||||
<field name="model">survey.print</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Survey Print">
|
||||
<separator string="Print Option" colspan="4"/>
|
||||
<field name="orientation" colspan="4"/>
|
||||
<field name="paper_size" colspan="4"/>
|
||||
<field name="survey_title" colspan="4"/>
|
||||
<field name="page_number" colspan="4"/>
|
||||
<field name="without_pagebreak" colspan="4"/>
|
||||
<separator colspan="4" />
|
||||
<label align="0.0" colspan="2" string="" />
|
||||
<button colspan="1" icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button colspan="1" icon="gtk-print" name="action_next" string="Print" type="object"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Survey Print action -->
|
||||
|
||||
<record id="action_view_survey_print" model="ir.actions.act_window">
|
||||
<field name="name">Print Survey</field>
|
||||
<field name="res_model">survey.print</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<act_window id="action_act_view_survey_print"
|
||||
key2="client_action_multi" name="Print Survey"
|
||||
res_model="survey.print" src_model="survey"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -41,6 +41,16 @@ class survey_print_answer(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Print Survey Answer in pdf format.
|
||||
|
||||
@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
|
||||
"""
|
||||
datas = {'ids' : context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size', 'page_number', 'without_pagebreak'], context)
|
||||
res = res and res[0] or {}
|
||||
|
|
|
@ -30,6 +30,16 @@ class survey_print_statistics(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Print Survey Statistics in pdf format.
|
||||
|
||||
@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 Survey statistics IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for created survey statistics report
|
||||
"""
|
||||
datas = {'ids' : context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['survey_ids'], context)
|
||||
res = res and res[0] or {}
|
||||
|
|
|
@ -27,6 +27,16 @@ class survey_name_wiz(osv.osv_memory):
|
|||
_name = 'survey.name.wiz'
|
||||
|
||||
def default_get(self, cr, uid, fields, context={}):
|
||||
"""
|
||||
Set the default value in survey_id field. if open this wizard in survey form then set the default value in survey_id = active survey id.
|
||||
|
||||
@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 fields: List of Survey statistics IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for created survey statistics report
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
data = super(survey_name_wiz, self).default_get(cr, uid, fields, context)
|
||||
|
@ -35,6 +45,16 @@ class survey_name_wiz(osv.osv_memory):
|
|||
return data
|
||||
|
||||
def _get_survey(self, cr, uid, context=None):
|
||||
"""
|
||||
Set the value In survey_id field.
|
||||
|
||||
@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 Survey statistics IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for created survey statistics report
|
||||
"""
|
||||
surv_obj = self.pool.get("survey")
|
||||
result = []
|
||||
if context.has_key('survey_id'):
|
||||
|
@ -69,6 +89,16 @@ class survey_name_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Start the survey, Increment in started survey field but if set the max_response_limit of survey then check the current user how many times start this survey. if current user max_response_limit is reach then this user can not start this survey(Raise Exception).
|
||||
|
||||
@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 Survey IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for open survey question wizard.
|
||||
"""
|
||||
survey_obj = self.pool.get('survey')
|
||||
search_obj = self.pool.get('ir.ui.view')
|
||||
|
||||
|
@ -100,6 +130,16 @@ class survey_name_wiz(osv.osv_memory):
|
|||
}
|
||||
|
||||
def on_change_survey(self, cr, uid, ids, survey_id, context=None):
|
||||
"""
|
||||
on change event of survey_id field, if note is available in selected survey then display this note in note fields.
|
||||
|
||||
@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 Survey IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary values of notes fields.
|
||||
"""
|
||||
notes = self.pool.get('survey').read(cr, uid, survey_id, ['note'])['note']
|
||||
return {'value': {'note' : notes}}
|
||||
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import pooler
|
||||
from random import choice
|
||||
import string
|
||||
import tools
|
||||
from tools.translate import _
|
||||
|
||||
_survey_form = '''<?xml version="1.0"?>
|
||||
<form string="Print Survey">
|
||||
<separator string="Print Option" colspan="4"/>
|
||||
<field name="orientation" colspan="4"/>
|
||||
<field name="paper_size" colspan="4"/>
|
||||
<field name="survey_title" colspan="4"/>
|
||||
<field name="page_number" colspan="4"/>
|
||||
<field name="without_pagebreak" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
_survey_fields = {
|
||||
'orientation':{
|
||||
'string':"Orientation",
|
||||
'type':'selection',
|
||||
'selection':[('vertical','Portrait(Vertical)'),
|
||||
('horizontal','Landscape(Horizontal)')],
|
||||
'default': lambda *a:'vertical'},
|
||||
'paper_size':{
|
||||
'string':"Paper Size",
|
||||
'type':'selection',
|
||||
'selection':[('letter','Letter (8.5" x 11")'),
|
||||
('legal','Legal (8.5" x 14")'),
|
||||
('a4','A4 (210mm x 297mm)')],
|
||||
'default': lambda *a:'letter'},
|
||||
'survey_title': {'string':'Include Survey Title', 'type':'boolean', 'default':lambda *a: 0},
|
||||
'page_number': {'string':'Include Page Numbers', 'type':'boolean', 'default':lambda *a: 0},
|
||||
'without_pagebreak': {'string':'Print Without Page Breaks', 'type':'boolean', 'default':lambda *a: 0},
|
||||
}
|
||||
|
||||
class print_survey_wizard(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'form', 'arch' :_survey_form, 'fields' :_survey_fields,\
|
||||
'state' : [('end', 'Cancel', 'gtk-cancel'), ('print', 'Print', 'gtk-print')]}
|
||||
},
|
||||
'print': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'survey.form', 'state':'end'}
|
||||
}
|
||||
}
|
||||
print_survey_wizard('wizard.print.survey')
|
Loading…
Reference in New Issue