[IMP]:survey:improved the survey analysis and browse report.(Ref:YSA).
bzr revid: apa@tinyerp.com-20100121131107-zj38q1kjvzpvq6y0
This commit is contained in:
parent
3c820d77a4
commit
fd6e04ba7e
|
@ -58,6 +58,22 @@ class survey_analysis(report_rml):
|
|||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_heading">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_head_2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
|
@ -71,31 +87,49 @@ class survey_analysis(report_rml):
|
|||
<paraStyle name="answer_bold" fontName="Helvetica-Bold" fontSize="09.0" leftIndent="2.0"/>
|
||||
<paraStyle name="answer" fontName="helvetica" fontSize="09.0" leftIndent="2.0"/>
|
||||
<paraStyle name="Title" fontName="helvetica" fontSize="20.0" leading="15" spaceBefore="6.0" spaceAfter="6.0" alignment="CENTER"/>
|
||||
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<para style="Title"><u>Response Summary</u></para>
|
||||
<para style="Standard"><font></font></para>"""
|
||||
<para style="Standard"><font></font></para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>"""
|
||||
surv_obj = pooler.get_pool(cr.dbname).get('survey')
|
||||
for survey in surv_obj.browse(cr, uid, ids):
|
||||
if survey.question_prefix:
|
||||
prefix = survey.question_prefix + " : "
|
||||
else:
|
||||
prefix = ''
|
||||
rml += """<blockTable colWidths="95,215,150,40" style="Table2">
|
||||
<tr>
|
||||
<td><para style="Standard">Survey Title :-</para></td>
|
||||
<td><para style="header1">""" + to_xml(survey.title) + """</para></td>
|
||||
<td><para style="Standard">Total Started Survey :- </para></td>
|
||||
<td><para style="header1">""" + tools.ustr(survey.tot_start_survey) + """</para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="Standard"></para></td>
|
||||
<td><para style="header1"></para></td>
|
||||
<td><para style="Standard">Total Completed Survey :-</para></td>
|
||||
<td><para style="header1">""" + tools.ustr(survey.tot_comp_survey) + """</para></td>
|
||||
</tr>
|
||||
</blockTable> """
|
||||
rml += """<blockTable colWidths="280.0,100.0,120.0" style="Table_heading">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Survey Title </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Total Started Survey </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Total Completed Survey </para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="280.0,100.0,120.0" style="Table_head_2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + to_xml(survey.title) + """</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + str(survey.tot_start_survey) + """</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + str(survey.tot_comp_survey) + """</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
for page in survey.page_ids:
|
||||
rml += """ <blockTable colWidths="500" style="Table4">
|
||||
# <tr>
|
||||
|
@ -137,7 +171,7 @@ class survey_analysis(report_rml):
|
|||
if cal['answer'] == matrix_ans[mat_col]:
|
||||
cal_count = cal['count']
|
||||
if tot_res:
|
||||
percantage = float(cal_count)*100 / tot_res
|
||||
percantage = float(cal_count)*100 / tot_res
|
||||
if percantage:
|
||||
rml += """<td color="#FFF435"><para style="answer_bold">""" + tools.ustr(percantage) +"% (" + tools.ustr(cal_count) + """)</para></td>"""
|
||||
else:
|
||||
|
@ -150,13 +184,13 @@ class survey_analysis(report_rml):
|
|||
tot_res = cr.fetchone()[0]
|
||||
rml+="""<blockTable colWidths=" """+ str(500 - last_col) +"," + str(last_col) + """ " style="Table1"><tr><td><para style="answer_right">""" + to_xml(que.comment_label) + """</para></td>
|
||||
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
|
||||
|
||||
elif que.type in['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans', 'multiple_textboxes','date_and_time','date']:
|
||||
rml +="""<blockTable colWidths="280.0,120,100.0" style="Table1">"""
|
||||
rml += """ <tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
rml += """ <tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response">Response Percentage </para></td>
|
||||
<td> <para style="response">Response Count</para></td>
|
||||
<td> <para style="response">Response Count</para></td>
|
||||
</tr>"""
|
||||
for ans in que.answer_choice_ids:
|
||||
rml+="""<tr><td><para style="answer">""" + to_xml(ans.answer) + """</para></td>
|
||||
|
@ -178,13 +212,13 @@ class survey_analysis(report_rml):
|
|||
tot_res = cr.fetchone()[0]
|
||||
rml+="""<blockTable colWidths="400.0,100.0" style="Table1"><tr><td><para style="answer_right">""" + to_xml(que.comment_label) + """</para></td>
|
||||
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
|
||||
|
||||
elif que.type in['single_textbox']:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %d and single_text!=''" % que.id)
|
||||
rml +="""<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response">Response Count</para></td>
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response">Response Count</para></td>
|
||||
</tr>
|
||||
<tr><td><para style="answer"></para></td>
|
||||
<td><para style="answer">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
|
||||
|
@ -192,9 +226,9 @@ class survey_analysis(report_rml):
|
|||
elif que.type in['comment']:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %d and comment !=''" % que.id)
|
||||
rml +="""<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response">Response Count</para></td>
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response">Response Count</para></td>
|
||||
</tr>
|
||||
<tr><td><para style="answer"></para></td>
|
||||
<td><para style="answer">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
|
||||
|
@ -249,7 +283,7 @@ class survey_analysis(report_rml):
|
|||
rml += """<blockTable colWidths="500" style="Table1"><tr>
|
||||
<td><para style="answer">""" + to_xml(column.title) + """</para></td></tr></blockTable>"""
|
||||
menu_choices = column.menu_choice.split('\n')
|
||||
cols_widhts = []
|
||||
cols_widhts = []
|
||||
cols_widhts.append(200)
|
||||
for col in range(0, len(menu_choices) + 1):
|
||||
cols_widhts.append(float(300 / (len(menu_choices) + 1)))
|
||||
|
@ -289,12 +323,12 @@ class survey_analysis(report_rml):
|
|||
rml += """</blockTable>"""
|
||||
elif que.type in['numerical_textboxes']:
|
||||
rml +="""<blockTable colWidths="240.0,20,100.0,70,70.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<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">Response Count</para></td>
|
||||
<td> <para style="response">Response 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)
|
||||
|
|
|
@ -83,6 +83,22 @@ class survey_browse_response(report_rml):
|
|||
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_heading">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_head_2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
|
@ -102,11 +118,17 @@ class survey_browse_response(report_rml):
|
|||
<paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="12" spaceBefore="0.0" spaceAfter="1.0"/>
|
||||
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<para style="Title"><u>Browse Responses </u></para>
|
||||
<para style="Standard"><font></font></para>"""
|
||||
<para style="Standard"><font></font></para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
"""
|
||||
surv_resp_obj = pooler.get_pool(cr.dbname).get('survey.response')
|
||||
surv_resp_line_obj = pooler.get_pool(cr.dbname).get('survey.response.line')
|
||||
surv_obj = pooler.get_pool(cr.dbname).get('survey')
|
||||
|
@ -116,18 +138,30 @@ class survey_browse_response(report_rml):
|
|||
prefix = survey.question_prefix + " : "
|
||||
else:
|
||||
prefix = ''
|
||||
rml += """<blockTable colWidths="150,350" style="Table2">
|
||||
rml += """<blockTable colWidths="230.0,150.0,120.0" style="Table_heading">
|
||||
<tr>
|
||||
<td><para style="Standard">Survey Title :-</para></td>
|
||||
<td><para style="header1">""" + to_xml(survey.title) + """</para></td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Survey Title </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Response Create Date </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Respose By </para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="230.0,150.0,120.0" style="Table_head_2">
|
||||
<tr>
|
||||
<td><para style="Standard">Response Create Date :-</para></td>
|
||||
<td><para style="header1">""" + to_xml(response.date_create) + """</para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="Standard">User Name :-</para></td>
|
||||
<td><para style="header1">""" + to_xml(response.user_id.name) + """</para></td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + to_xml(survey.title) + """</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + to_xml(response.date_create) + """</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + to_xml(response.user_id.name) + """</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
for page in survey.page_ids:
|
||||
|
|
|
@ -648,7 +648,7 @@ class survey_question_wiz(osv.osv_memory):
|
|||
que_rec = que_obj.read(cr, uid, que)
|
||||
descriptive_text = ""
|
||||
separator_string = tools.ustr(qu_no) + "." + tools.ustr(que_rec['question'])
|
||||
if que_rec['is_require_answer'] or que_rec['required_type'] != '':
|
||||
if not context.has_key('active') and (que_rec['is_require_answer'] or que_rec['required_type'] != ''):
|
||||
star='*'
|
||||
else:
|
||||
star=''
|
||||
|
|
|
@ -31,6 +31,7 @@ import tools
|
|||
import os
|
||||
import datetime
|
||||
import netsvc
|
||||
import socket
|
||||
|
||||
_survey_form = '''<?xml version="1.0"?>
|
||||
<form string="Send Invitation">
|
||||
|
@ -91,7 +92,7 @@ def check_survey(self, cr, uid, data, context):
|
|||
raise wizard.except_wizard(_('Attention!'), _('%sSurvey is not in open state') % msg)
|
||||
data['form']['mail'] = '''Hello %(name)s, \n\n We are inviting you for following survey. \
|
||||
\n ''' + name + '''\n Your login ID: %(login)s, Your password: %(passwd)s
|
||||
\n link :- http://localhost:8080 \n\n Thanks,'''
|
||||
\n link :- http://'''+ str(socket.gethostname()) + ''':8080 \n\n Thanks,'''
|
||||
return data['form']
|
||||
|
||||
def send_mail(self, cr, uid, data, context):
|
||||
|
|
Loading…
Reference in New Issue