[IMP] survey :- change string response to answer.

bzr revid: ysa@tinyerp.co.in-20100405115901-r1x3a77bkvuo5434
This commit is contained in:
Ysa (Open ERP)
2010-04-05 17:29:01 +05:30
parent 2334fd27ac
commit 3f3f8d463a
10 changed files with 47 additions and 48 deletions
+11 -11
View File
@@ -95,7 +95,7 @@ class survey_analysis(report_rml):
</stylesheet>
<images/>
<story>
<para style="Title"><u>Response Summary</u></para>
<para style="Title"><u>Answer Summary</u></para>
<para style="Standard"><font></font></para>
<para style="P2">
<font color="white"> </font>
@@ -158,7 +158,7 @@ class survey_analysis(report_rml):
rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
for mat_col in range(0, len(matrix_ans)):
rml+="""<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
rml += """<td><para style="response-bold">Response Count</para></td>
rml += """<td><para style="response-bold">Answer Count</para></td>
</tr>"""
last_col = cols_widhts[-1]
@@ -194,8 +194,8 @@ class survey_analysis(report_rml):
rml += """<blockTable colWidths="240.0,210,50.0" style="Table1">"""
rml += """ <tr>
<td> <para style="Standard"> </para></td>
<td> <para style="terp_default_Center_heading">Response Percentage</para></td>
<td> <para style="response-bold">Response Count</para></td>
<td> <para style="terp_default_Center_heading">Answer Percentage</para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>"""
for ans in que.answer_choice_ids:
@@ -238,7 +238,7 @@ class survey_analysis(report_rml):
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
<tr>
<td> <para style="Standard"> </para></td>
<td> <para style="response-bold">Response Count</para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>
<tr><td><para style="answer"></para></td>
<td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
@@ -249,7 +249,7 @@ class survey_analysis(report_rml):
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
<tr>
<td> <para style="Standard"> </para></td>
<td> <para style="response-bold">Response Count</para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>
<tr><td><para style="answer"></para></td>
<td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
@@ -269,7 +269,7 @@ class survey_analysis(report_rml):
for mat_col in range(0,len(matrix_ans)):
rml += """<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
rml += """<td><para style="response-bold">Rating Average</para></td>
<td><para style="response-bold">Response Count</para></td>
<td><para style="response-bold">Answer Count</para></td>
</tr>"""
for ans in que.answer_choice_ids:
@@ -325,7 +325,7 @@ class survey_analysis(report_rml):
for menu in menu_choices:
rml += """<td><para style="response">""" + to_xml(tools.ustr(menu)) + """</para></td>"""
rml += """<td><para style="response-bold">Response Count</para></td></tr>"""
rml += """<td><para style="response-bold">Answer Count</para></td></tr>"""
cr.execute("select count(id), sra.answer_id from survey_response_answer sra \
where sra.column_id='%s' group by sra.answer_id " % (column.id))
res_count = cr.dictfetchall()
@@ -363,9 +363,9 @@ class survey_analysis(report_rml):
<tr>
<td> <para style="Standard"> </para></td>
<td> <para style="Standard"> </para></td>
<td> <para style="response">Response Average</para></td>
<td> <para style="response">Response Total</para></td>
<td> <para style="response-bold">Response Count</para></td>
<td> <para style="response">Answer Average</para></td>
<td> <para style="response">Answer Total</para></td>
<td> <para style="response-bold">Answer Count</para></td>
</tr>"""
for ans in que.answer_choice_ids:
cr.execute("select answer from survey_response_answer where answer_id=%d group by answer" % ans.id)
+10 -10
View File
@@ -51,8 +51,8 @@ class survey_browse_response(report_rml):
_frame_width = tools.ustr(_pageSize[0])
_frame_height = tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.90))+'cm'
_tbl_widths = tools.ustr(float(_pageSize[0].replace('cm','')) - float(2.10))+'cm'
rml ="""<document filename="Survey Response Report.pdf">
<template pageSize="("""+_pageSize[0]+""","""+_pageSize[1]+""")" title='Survey Response.pdf' author="Martin Simon" allowSplitting="20" >
rml ="""<document filename="Survey Answer Report.pdf">
<template pageSize="("""+_pageSize[0]+""","""+_pageSize[1]+""")" title='Survey Answer.pdf' author="Martin Simon" allowSplitting="20" >
<pageTemplate id="first">
<frame id="first" x1="0.0cm" y1="1.0cm" width='"""+_frame_width+"""' height='"""+_frame_height+"""'/>
<pageGraphics>
@@ -203,10 +203,10 @@ class survey_browse_response(report_rml):
colwidth = "4.6cm,5cm," + str(tbl_width - 16.4) +"cm,4cm,3cm"
rml += """<blockTable colWidths='""" + colwidth + """' style="Table_heading">
<tr>
<td><para style="terp_tblheader_General_Centre">Response Create Date:- </para></td>
<td><para style="terp_tblheader_General_Centre">Answer Create Date:- </para></td>
<td><para style="terp_tblheader_General_Centre_simple">""" + to_xml(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S'))) + """</para></td>
<td><para style="terp_tblheader_General_Centre"></para></td>
<td><para style="terp_tblheader_General_right">Response By:- </para></td>
<td><para style="terp_tblheader_General_right">Answer By:- </para></td>
<td><para style="terp_tblheader_General_right_simple">""" + to_xml(response.user_id.login) + """</para></td>
</tr>
</blockTable><para style="P2"></para>"""
@@ -289,7 +289,7 @@ class survey_browse_response(report_rml):
else:
rml +="""<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">No Response</para></td> </tr>
<tr><td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['multiple_choice_only_one_ans','multiple_choice_multiple_ans']:
@@ -363,7 +363,7 @@ class survey_browse_response(report_rml):
<td><para style="answer">""" + to_xml(tools.ustr(answer[0].comment)) + """</para></td></tr></blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">No Response</para></td> </tr>
<tr><td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['multiple_textboxes_diff_type','multiple_textboxes','date','date_and_time','numerical_textboxes','multiple_textboxes_diff_type']:
@@ -390,7 +390,7 @@ class survey_browse_response(report_rml):
</blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">No Response</para></td> </tr>
<tr> <td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['single_textbox']:
@@ -400,7 +400,7 @@ class survey_browse_response(report_rml):
</blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">No Response</para></td> </tr>
<tr> <td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['comment']:
@@ -410,7 +410,7 @@ class survey_browse_response(report_rml):
</blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr> <td> <para style="response">No Response</para></td> </tr>
<tr> <td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
elif que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans', 'rating_scale', 'matrix_of_drop_down_menus']:
@@ -507,7 +507,7 @@ class survey_browse_response(report_rml):
<td><para style="answer">""" + to_xml(tools.ustr(answer[0].comment or '')) + """</para></td></tr></blockTable>"""
else:
rml += """<blockTable colWidths='""" + str(_tbl_widths) + """' style="simple_table">
<tr><td> <para style="response">No Response</para></td> </tr>
<tr><td> <para style="response">No Answer</para></td> </tr>
</blockTable>"""
if datas.has_key('form') and not datas['form']['without_pagebreak']:
+15 -16
View File
@@ -55,9 +55,9 @@ class survey(osv.osv):
'page_ids': fields.one2many('survey.page', 'survey_id', 'Page'),
'date_open': fields.datetime('Survey Open Date', readonly=1),
'date_close': fields.datetime('Survey Close Date', readonly=1),
'max_response_limit': fields.integer('Maximum Response Limit'),
'response_user': fields.integer('Maximum Response per User',
help="Set to one if you require only one response per user"),
'max_response_limit': fields.integer('Maximum Answer Limit'),
'response_user': fields.integer('Maximum Answer per User',
help="Set to one if you require only one Answer per user"),
'state': fields.selection([('draft', 'Draft'), ('open', 'Open'), ('close', 'Closed'), ('cancel', 'Cancelled')], 'Status', readonly=True),
'responsible_id': fields.many2one('res.users', 'Responsible'),
'tot_start_survey': fields.integer("Total Started Survey", readonly=1),
@@ -65,7 +65,7 @@ class survey(osv.osv):
'note': fields.text('Description', size=128),
'history': fields.one2many('survey.history', 'survey_id', 'History Lines', readonly=True),
'users': fields.many2many('res.users', 'survey_users_rel', 'sid', 'uid', 'Users'),
'send_response': fields.boolean('E-mail Notification on Response'),
'send_response': fields.boolean('E-mail Notification on Answer'),
'type': fields.many2one('survey.type', 'Type'),
}
_defaults = {
@@ -183,7 +183,6 @@ class survey_question(osv.osv):
'page_id': fields.many2one('survey.page', 'Survey Page', ondelete='cascade', required=1),
'question': fields.char('Question', size=128, required=1),
'answer_choice_ids': fields.one2many('survey.answer', 'question_id', 'Answer'),
'response_ids': fields.one2many('survey.response.line', 'question_id', 'Response', readonly=1),
'is_require_answer': fields.boolean('Require Answer to Question (optional)'),
'required_type': fields.selection([('all','All'), ('at least','At Least'), ('at most','At Most'), ('exactly','Exactly'), ('a range','A Range')], 'Respondent must answer'),
'req_ans': fields.integer('#Required Answer'),
@@ -192,7 +191,7 @@ class survey_question(osv.osv):
'req_error_msg': fields.text('Error Message'),
'allow_comment': fields.boolean('Allow Comment Field'),
'sequence': fields.integer('Sequence'),
'tot_resp': fields.function(_calc_response, method=True, string="Total Response"),
'tot_resp': fields.function(_calc_response, method=True, string="Total Answer"),
'survey': fields.related('page_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
'descriptive_text': fields.text('Descriptive Text', size=255),
'column_heading_ids': fields.one2many('survey.question.column.heading', 'question_id',' Column heading'),
@@ -245,7 +244,7 @@ class survey_question(osv.osv):
'validation_valid_err_msg': fields.text('Error message'),
'numeric_required_sum': fields.integer('Sum of all choices'),
'numeric_required_sum_err_msg': fields.text('Error message'),
'rating_allow_one_column_require': fields.boolean('Allow Only One Response per Column (Forced Ranking)'),
'rating_allow_one_column_require': fields.boolean('Allow Only One Answer per Column (Forced Ranking)'),
'in_visible_rating_weight': fields.boolean('Is Rating Scale Invisible?'),
'in_visible_menu_choice': fields.boolean('Is Menu Choice Invisible?'),
'in_visible_answer_type': fields.boolean('Is Answer Type Invisible?'),
@@ -524,7 +523,7 @@ class survey_answer(osv.osv):
'question_id': fields.many2one('survey.question', 'Question', ondelete='cascade'),
'answer': fields.char('Answer', size=128, required=1),
'sequence': fields.integer('Sequence'),
'response': fields.function(_calc_response_avg, method=True, string="#Response", multi='sums'),
'response': fields.function(_calc_response_avg, method=True, string="#Answer", multi='sums'),
'average': fields.function(_calc_response_avg, method=True, string="#Avg", multi='sums'),
'type': fields.selection([('char','Character'),('date','Date'),('datetime','Date & Time'),\
('integer','Integer'),('float','Float'),('selection','Selection'),\
@@ -555,8 +554,8 @@ class survey_response(osv.osv):
'date_create' : fields.datetime('Create Date', required=1),
'user_id' : fields.many2one('res.users', 'User'),
'response_type' : fields.selection([('manually', 'Manually'), ('link', 'Link')], \
'Response Type', required=1, readonly=1),
'question_ids' : fields.one2many('survey.response.line', 'response_id', 'Response Answer'),
'Answer Type', required=1, readonly=1),
'question_ids' : fields.one2many('survey.response.line', 'response_id', 'Answer'),
'state' : fields.selection([('done', 'Finished '),('skip', 'Not Finished')], \
'Status', readonly=True),
}
@@ -585,16 +584,16 @@ class survey_response_line(osv.osv):
_description = 'Survey Response Line'
_rec_name = 'date_create'
_columns = {
'response_id': fields.many2one('survey.response', 'Response', ondelete='cascade'),
'response_id': fields.many2one('survey.response', 'Answer', ondelete='cascade'),
'date_create': fields.datetime('Create Date', required=1),
'state': fields.selection([('draft', 'Draft'), ('done', 'Answered'),('skip', 'Skiped')],\
'Status', readonly=True),
'question_id': fields.many2one('survey.question', 'Question'),
'page_id': fields.related('question_id', 'page_id', type='many2one', \
relation='survey.page', string='Page'),
'response_answer_ids': fields.one2many('survey.response.answer', 'response_id', 'Response Answer'),
'response_answer_ids': fields.one2many('survey.response.answer', 'response_id', 'Answer'),
'response_table_ids': fields.one2many('survey.tbl.column.heading', \
'response_table_id', 'Response Answer'),
'response_table_id', 'Answer'),
'comment': fields.text('Notes'),
'single_text': fields.char('Text', size=255),
}
@@ -611,17 +610,17 @@ class survey_tbl_column_heading(osv.osv):
'name': fields.integer('Row Number'),
'column_id': fields.many2one('survey.question.column.heading', 'Column'),
'value': fields.char('Value', size = 255),
'response_table_id': fields.many2one('survey.response.line', 'Response', ondelete='cascade'),
'response_table_id': fields.many2one('survey.response.line', 'Answer', ondelete='cascade'),
}
survey_tbl_column_heading()
class survey_response_answer(osv.osv):
_name = 'survey.response.answer'
_description = 'Survey Response Answer'
_description = 'Survey Answer'
_rec_name = 'response_id'
_columns = {
'response_id': fields.many2one('survey.response.line', 'Response', ondelete='cascade'),
'response_id': fields.many2one('survey.response.line', 'Answer', ondelete='cascade'),
'answer_id': fields.many2one('survey.answer', 'Answer', required=1, ondelete='cascade'),
'column_id': fields.many2one('survey.question.column.heading','Column'),
'answer': fields.char('Value', size =255),
+5 -5
View File
@@ -113,7 +113,7 @@ class survey_question_wiz(osv.osv_memory):
user_limit = survey_obj.browse(cr, uid, survey_id)
user_limit = user_limit.response_user
if user_limit and res >= user_limit:
raise osv.except_osv(_('Warning !'),_("You can not give response for this survey more than %s times") % (user_limit))
raise osv.except_osv(_('Warning !'),_("You can not give answer for this survey more than %s times") % (user_limit))
if sur_rec.max_response_limit and sur_rec.max_response_limit <= sur_rec.tot_start_survey and not sur_name_rec.page_no + 1:
survey_obj.write(cr, uid, survey_id, {'state':'close', 'date_close':strftime("%Y-%m-%d %H:%M:%S")})
@@ -411,11 +411,11 @@ class survey_question_wiz(osv.osv_memory):
if user_email and resp_email:
user_name = user_obj.browse(cr, uid, uid).name
mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_name) + " Give Response Of " + survey_data.title + " Survey.\n\n Thanks,"
tools.email_send(user_email, [resp_email], "Survey Response Of " + str(user_name) , mail, attach = attachments)
tools.email_send(user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, attach = attachments)
xml_form = etree.Element('form', {'string': _('Complete Survey Response')})
xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"})
etree.SubElement(xml_form, 'label', {'string': 'Thanks for your response'})
etree.SubElement(xml_form, 'label', {'string': 'Thanks for your Answer'})
etree.SubElement(xml_form, 'newline')
etree.SubElement(xml_form, 'button', {'icon': "gtk-go-forward", 'special':"cancel",'string':"OK",'colspan':"2"})
root = xml_form.getroottree()
@@ -426,7 +426,7 @@ class survey_question_wiz(osv.osv_memory):
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.
If any user give answer of survey then last create report of this answer and if 'E-mail Notification on Answer' 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,
+1 -1
View File
@@ -46,7 +46,7 @@ class survey_browse_answer(osv.osv_memory):
_columns = {
'survey_id': fields.selection(_get_survey, "Survey", required="1"),
'response_id': fields.many2one("survey.response", "Survey Response"),
'response_id': fields.many2one("survey.response", "Survey Answer"),
}
def action_next(self, cr, uid, ids, context=None):
@@ -12,7 +12,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Survey">
<separator colspan="4" string = "Select Survey and related response"/>
<separator colspan="4" string = "Select Survey and related answer"/>
<field name="survey_id" width="250"/>
<field name="response_id" domain="[('survey_id','=', survey_id)]"/>
<separator colspan="4" />
+1 -1
View File
@@ -28,7 +28,7 @@ class survey_print_answer(osv.osv_memory):
_name = 'survey.print.answer'
_columns = {
'response_ids': fields.many2many('survey.response','survey_print_response',\
'response_id','print_id', "Response", required="1"),
'response_id','print_id', "Answer", required="1"),
'orientation': fields.selection([('vertical','Portrait(Vertical)'),\
('horizontal','Landscape(Horizontal)')], 'Orientation'),
'paper_size': fields.selection([('letter','Letter (8.5" x 11")'),\
+1 -1
View File
@@ -80,7 +80,7 @@ class survey_name_wiz(osv.osv_memory):
'page': fields.char('Page Position',size = 12),
'transfer': fields.boolean('Page Transfer'),
'store_ans': fields.text('Store Answer'),
'response': fields.char('Response',size=16)
'response': fields.char('Answer',size=16)
}
_defaults = {
'page_no': lambda * a: - 1,
+1 -1
View File
@@ -34,7 +34,7 @@
<record id="action_view_survey_name"
model="ir.actions.act_window">
<field name="name">Give Survey Response</field>
<field name="name">Give Survey Answer</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">survey.name.wiz</field>
<field name="view_type">form</field>
@@ -38,7 +38,7 @@ class survey_send_invitation(osv.osv_memory):
_name = 'survey.send.invitation'
_columns = {
'partner_ids': fields.many2many('res.partner','survey_res_partner','partner_id',\
'survey_id', "Response", required=1),
'survey_id', "Answer", required=1),
'send_mail': fields.boolean('Send mail for new user'),
'send_mail_existing': fields.boolean('Send reminder for existing user'),
'mail_subject': fields.char('Subject', size=256, required=1),