[IMP]:survey:(REF.YSA)

*Improved module with response mail.
*Improved the browse and print survey report.
*Improved demo data for survey.

bzr revid: apa@tinyerp.com-20100122121346-e2ccbpx4uh6gxqpw
This commit is contained in:
apa-tiny 2010-01-22 17:43:46 +05:30
parent 767e644faf
commit 1134203b6c
6 changed files with 290 additions and 242 deletions

View File

@ -120,7 +120,7 @@ class survey_analysis(report_rml):
<blockTable colWidths="280.0,100.0,120.0" style="Table_head_2"> <blockTable colWidths="280.0,100.0,120.0" style="Table_head_2">
<tr> <tr>
<td> <td>
<para style="terp_default_Centre_8">""" + to_xml(survey.title) + """</para> <para style="terp_default_Centre_8">""" + to_xml(tools.ustr(survey.title)) + """</para>
</td> </td>
<td> <td>
<para style="terp_default_Centre_8">""" + str(survey.tot_start_survey) + """</para> <para style="terp_default_Centre_8">""" + str(survey.tot_start_survey) + """</para>
@ -133,13 +133,13 @@ class survey_analysis(report_rml):
for page in survey.page_ids: for page in survey.page_ids:
rml += """ <blockTable colWidths="500" style="Table4"> rml += """ <blockTable colWidths="500" style="Table4">
# <tr> # <tr>
# <td><para style="page">Page :- """ + to_xml(page.title) + """</para></td> # <td><para style="page">Page :- """ + to_xml(tools.ustr(page.title)) + """</para></td>
# </tr> # </tr>
# </blockTable>""" # </blockTable>"""
for que in page.question_ids: for que in page.question_ids:
rml +="""<blockTable colWidths="500" style="Table5"> rml +="""<blockTable colWidths="500" style="Table5">
<tr> <tr>
<td><para style="question">""" + tools.ustr(prefix) + to_xml(que.question) + """</para></td> <td><para style="question">""" + to_xml(tools.ustr(prefix)) + to_xml(tools.ustr(que.question)) + """</para></td>
</tr> </tr>
</blockTable>""" </blockTable>"""
cols_widhts = [] cols_widhts = []
@ -154,12 +154,12 @@ class survey_analysis(report_rml):
matrix_ans.append(col.title) matrix_ans.append(col.title)
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>""" rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
for mat_col in matrix_ans: for mat_col in matrix_ans:
rml+="""<td><para style="response">""" + to_xml(mat_col) + """</para></td>""" rml+="""<td><para style="response">""" + to_xml(tools.ustr(mat_col)) + """</para></td>"""
rml+="""<td><para style="response">Response Count</para></td> rml+="""<td><para style="response">Response Count</para></td>
</tr>""" </tr>"""
last_col = cols_widhts[-1] last_col = cols_widhts[-1]
for ans in que.answer_choice_ids: for ans in que.answer_choice_ids:
rml+="""<tr><td><para style="answer">""" + to_xml(ans.answer) + """</para></td>""" rml+="""<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
cr.execute("select count(id) from survey_response_answer sra where sra.answer_id = %d"%(ans.id)) cr.execute("select count(id) from survey_response_answer sra where sra.answer_id = %d"%(ans.id))
tot_res = cr.fetchone()[0] tot_res = cr.fetchone()[0]
cr.execute("select count(id) ,sra.answer from survey_response_answer sra where sra.answer_id = %d group by sra.answer" % ans.id) cr.execute("select count(id) ,sra.answer from survey_response_answer sra where sra.answer_id = %d group by sra.answer" % ans.id)
@ -182,7 +182,7 @@ class survey_analysis(report_rml):
if que.comment_field_type: if que.comment_field_type:
cr.execute("select count(id) from survey_response_line where question_id = %d and comment != ''"% que.id) cr.execute("select count(id) from survey_response_line where question_id = %d and comment != ''"% que.id)
tot_res = cr.fetchone()[0] 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> rml+="""<blockTable colWidths=" """+ str(500 - last_col) +"," + str(last_col) + """ " style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>""" <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']: elif que.type in['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans', 'multiple_textboxes','date_and_time','date']:
@ -193,7 +193,7 @@ class survey_analysis(report_rml):
<td> <para style="response">Response Count</para></td> <td> <para style="response">Response Count</para></td>
</tr>""" </tr>"""
for ans in que.answer_choice_ids: for ans in que.answer_choice_ids:
rml+="""<tr><td><para style="answer">""" + to_xml(ans.answer) + """</para></td> rml+="""<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
<td><para style="answer">""" + tools.ustr(ans.average) + """%</para></td> <td><para style="answer">""" + tools.ustr(ans.average) + """%</para></td>
<td><para style="answer">""" + tools.ustr(ans.response) + """</para></td></tr>""" <td><para style="answer">""" + tools.ustr(ans.response) + """</para></td></tr>"""
rml+="""</blockTable>""" rml+="""</blockTable>"""
@ -204,13 +204,13 @@ class survey_analysis(report_rml):
tot_avg = 0.00 tot_avg = 0.00
if que.tot_resp: if que.tot_resp:
tot_avg = round(float(tot_res * 100)/ que.tot_resp,2) tot_avg = round(float(tot_res * 100)/ que.tot_resp,2)
rml+="""<blockTable colWidths="280.0,120,100.0" style="Table1"><tr><td><para style="answer">""" + to_xml(que.comment_label) + """</para></td> rml+="""<blockTable colWidths="280.0,120,100.0" style="Table1"><tr><td><para style="answer">""" +to_xml(tools.ustr(que.comment_label)) + """</para></td>
<td><para style="answer">""" + str(tot_avg) + """%</para></td> <td><para style="answer">""" + str(tot_avg) + """%</para></td>
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>""" <td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
else: else:
cr.execute("select count(id) from survey_response_line where question_id = %d and comment != ''"% que.id) cr.execute("select count(id) from survey_response_line where question_id = %d and comment != ''"% que.id)
tot_res = cr.fetchone()[0] 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> rml+="""<blockTable colWidths="400.0,100.0" style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>""" <td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
elif que.type in['single_textbox']: elif que.type in['single_textbox']:
@ -244,12 +244,12 @@ class survey_analysis(report_rml):
matrix_ans.append(col.title) matrix_ans.append(col.title)
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>""" rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
for mat_col in matrix_ans: for mat_col in matrix_ans:
rml+="""<td><para style="response">""" + to_xml(mat_col) + """</para></td>""" rml+="""<td><para style="response">""" + to_xml(tools.ustr(mat_col)) + """</para></td>"""
rml+="""<td><para style="response">Rating Average</para></td> rml+="""<td><para style="response">Rating Average</para></td>
<td><para style="response">Response Count</para></td> <td><para style="response">Response Count</para></td>
</tr>""" </tr>"""
for ans in que.answer_choice_ids: for ans in que.answer_choice_ids:
rml+="""<tr><td><para style="answer">""" + to_xml(ans.answer) + """</para></td>""" rml+="""<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
res_count = 0 res_count = 0
rating_weight_sum = 0 rating_weight_sum = 0
for mat_col in range(1, len(matrix_ans)): for mat_col in range(1, len(matrix_ans)):
@ -281,7 +281,7 @@ class survey_analysis(report_rml):
elif que.type in['matrix_of_drop_down_menus']: elif que.type in['matrix_of_drop_down_menus']:
for column in que.column_heading_ids: for column in que.column_heading_ids:
rml += """<blockTable colWidths="500" style="Table1"><tr> rml += """<blockTable colWidths="500" style="Table1"><tr>
<td><para style="answer">""" + to_xml(column.title) + """</para></td></tr></blockTable>""" <td><para style="answer">""" + to_xml(tools.ustr(column.title)) + """</para></td></tr></blockTable>"""
menu_choices = column.menu_choice.split('\n') menu_choices = column.menu_choice.split('\n')
cols_widhts = [] cols_widhts = []
cols_widhts.append(200) cols_widhts.append(200)
@ -291,7 +291,7 @@ class survey_analysis(report_rml):
rml +="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr> rml +="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>
<td><para style="response"></para></td>""" <td><para style="response"></para></td>"""
for menu in menu_choices: for menu in menu_choices:
rml += """<td><para style="response">""" + to_xml(menu) + """</para></td>""" rml += """<td><para style="response">""" + to_xml(tools.ustr(menu)) + """</para></td>"""
rml += """<td><para style="response">Response Count</para></td></tr>""" rml += """<td><para style="response">Response Count</para></td></tr>"""
cr.execute("select count(id), sra.answer_id from survey_response_answer sra \ cr.execute("select count(id), sra.answer_id from survey_response_answer sra \
where sra.answer='%s' group by sra.answer_id " % (column.title)) where sra.answer='%s' group by sra.answer_id " % (column.title))
@ -300,7 +300,7 @@ class survey_analysis(report_rml):
where sra.answer='%s' group by sra.value_choice ,sra.answer_id, sra.answer" % (column.title)) where sra.answer='%s' group by sra.value_choice ,sra.answer_id, sra.answer" % (column.title))
calc_percantage = cr.dictfetchall() calc_percantage = cr.dictfetchall()
for ans in que.answer_choice_ids: for ans in que.answer_choice_ids:
rml+="""<tr><td><para style="answer_right">""" + to_xml(ans.answer) + """</para></td>""" rml+="""<tr><td><para style="answer_right">""" + tto_xml(tools.ustr(ans.answer)) + """</para></td>"""
for mat_col in range(0, len(menu_choices)): for mat_col in range(0, len(menu_choices)):
calc = 0 calc = 0
response = 0 response = 0
@ -339,7 +339,7 @@ class survey_analysis(report_rml):
per = 0.00 per = 0.00
if len(tot_res): if len(tot_res):
per = round((float(total) / len(tot_res)),2) per = round((float(total) / len(tot_res)),2)
rml+="""<tr><td><para style="answer">""" + to_xml(ans.answer) + """</para></td> rml+="""<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
<td> <para style="Standard"> </para></td> <td> <para style="Standard"> </para></td>
<td> <para style="answer">""" + tools.ustr(per) +"""</para></td> <td> <para style="answer">""" + tools.ustr(per) +"""</para></td>
<td><para style="answer">""" + tools.ustr(total) + """</para></td> <td><para style="answer">""" + tools.ustr(total) + """</para></td>

View File

@ -132,216 +132,222 @@ class survey_browse_response(report_rml):
surv_resp_obj = pooler.get_pool(cr.dbname).get('survey.response') 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_resp_line_obj = pooler.get_pool(cr.dbname).get('survey.response.line')
surv_obj = pooler.get_pool(cr.dbname).get('survey') surv_obj = pooler.get_pool(cr.dbname).get('survey')
for response in surv_resp_obj.browse(cr,uid, surv_resp_obj.search(cr,uid, [('survey_id','=',ids[0])])): for id in ids:
for survey in surv_obj.browse(cr, uid, ids): for survey in surv_obj.browse(cr, uid, [id]):
if survey.question_prefix: if context.has_key('response_id'):
prefix = survey.question_prefix + " : " s_id = [int(context['response_id'])]
else: else:
prefix = '' s_id = surv_resp_obj.search(cr,uid, [('survey_id','=',[survey.id])])
rml += """<blockTable colWidths="230.0,150.0,120.0" style="Table_heading"> for response in surv_resp_obj.browse(cr,uid,s_id): #surv_resp_obj.search(cr,uid, [('survey_id','=',ids[0])])
<tr> if survey.question_prefix:
<td> prefix = survey.question_prefix + " : "
<para style="terp_tblheader_General_Centre">Survey Title </para> else:
</td> prefix = ''
<td> rml += """<blockTable colWidths="230.0,150.0,120.0" style="Table_heading">
<para style="terp_tblheader_General_Centre">Response Create Date </para> <tr>
</td> <td>
<td> <para style="terp_tblheader_General_Centre">Survey Title </para>
<para style="terp_tblheader_General_Centre">Respose By </para> </td>
</td> <td>
</tr> <para style="terp_tblheader_General_Centre">Response Create Date </para>
</blockTable> </td>
<blockTable colWidths="230.0,150.0,120.0" style="Table_head_2"> <td>
<tr> <para style="terp_tblheader_General_Centre">Respose By </para>
<td> </td>
<para style="terp_default_Centre_8">""" + to_xml(survey.title) + """</para> </tr>
</td> </blockTable>
<td> <blockTable colWidths="230.0,150.0,120.0" style="Table_head_2">
<para style="terp_default_Centre_8">""" + to_xml(response.date_create) + """</para> <tr>
</td> <td>
<td> <para style="terp_default_Centre_8">""" + to_xml(tools.ustr(survey.title)) + """</para>
<para style="terp_default_Centre_8">""" + to_xml(response.user_id.name) + """</para> </td>
</td> <td>
</tr> <para style="terp_default_Centre_8">""" + to_xml(response.date_create) + """</para>
</blockTable>""" </td>
for page in survey.page_ids: <td>
rml += """<para style="P2"></para> <para style="terp_default_Centre_8">""" + to_xml(response.user_id.name) + """</para>
<blockTable colWidths="500" style="Table4"> </td>
<tr> </tr>
<td><para style="page">Page :- """ + to_xml(page.title) + """</para></td>
</tr>
</blockTable>"""
for que in page.question_ids:
rml += """<para style="P2"></para>
<blockTable colWidths="500" style="Table5">
<tr>
<td><para style="question">""" + tools.ustr(prefix) + to_xml(que.question) + """</para></td>
</tr>
</blockTable>"""
answer = surv_resp_line_obj.browse(cr,uid, surv_resp_line_obj.search(cr, uid, [('question_id','=',que.id),('response_id','=',response.id)]))
if que.type in ['descriptive_text']:
rml +="""<blockTable colWidths="500" style="Table1">
<tr> <td> <para style="response">""" + to_xml(que.descriptive_text) + """</para></td> </tr>
</blockTable>""" </blockTable>"""
elif que.type in ['table']: for page in survey.page_ids:
if len(answer) and answer[0].state == "done": rml += """<para style="P2"></para>
col_heading = pooler.get_pool(cr.dbname).get('survey.tbl.column.heading') <blockTable colWidths="500" style="Table4">
cols_widhts = [] <tr>
for col in range(0, len(que.column_heading_ids)): <td><para style="page">Page :- """ + to_xml(tools.ustr(page.title)) + """</para></td>
cols_widhts.append(float(500 / (len(que.column_heading_ids)))) </tr>
colWidths = ",".join(map(tools.ustr, cols_widhts)) </blockTable>"""
matrix_ans = [] for que in page.question_ids:
rml +="""<para style="P2"></para><blockTable colWidths=" """ + str(colWidths) + """ " style="Table41"><tr>""" rml += """<para style="P2"></para>
for col in que.column_heading_ids: <blockTable colWidths="500" style="Table5">
if col.title not in matrix_ans: <tr>
matrix_ans.append(col.title) <td><para style="question">""" + to_xml(tools.ustr(prefix)) + to_xml(to_xml(que.question)) + """</para></td>
rml +="""<td> <para style="terp_tblheader_Details">""" + col.title +"""</para></td>""" </tr>
rml += """</tr></blockTable>""" </blockTable>"""
for row in range(0, que.no_of_rows): answer = surv_resp_line_obj.browse(cr,uid, surv_resp_line_obj.search(cr, uid, [('question_id','=',que.id),('response_id','=',response.id)]))
rml +="""<blockTable colWidths=" """ + str(colWidths) + """ " style="Table51"><tr>""" if que.type in ['descriptive_text']:
table_data = col_heading.browse(cr, uid, col_heading.search(cr, uid, [('response_table_id', '=', answer[0].id),('name','=',row)])) rml +="""<blockTable colWidths="500" style="Table1">
for column in matrix_ans: <tr> <td> <para style="response">""" + to_xml(tools.ustr(que.descriptive_text)) + """</para></td> </tr>
value = """<font color="white"> </font>""" </blockTable>"""
for col in table_data: elif que.type in ['table']:
if column == col.column_id.title: if len(answer) and answer[0].state == "done":
value = col.value col_heading = pooler.get_pool(cr.dbname).get('survey.tbl.column.heading')
rml += """<td> <para style="terp_default_9">""" + value +"""</para></td>""" cols_widhts = []
for col in range(0, len(que.column_heading_ids)):
cols_widhts.append(float(500 / (len(que.column_heading_ids))))
colWidths = ",".join(map(tools.ustr, cols_widhts))
matrix_ans = []
rml +="""<para style="P2"></para><blockTable colWidths=" """ + str(colWidths) + """ " style="Table41"><tr>"""
for col in que.column_heading_ids:
if col.title not in matrix_ans:
matrix_ans.append(col.title)
rml +="""<td> <para style="terp_tblheader_Details">""" + to_xml(tools.ustr(col.title)) +"""</para></td>"""
rml += """</tr></blockTable>""" rml += """</tr></blockTable>"""
else: for row in range(0, que.no_of_rows):
rml +="""<blockTable colWidths="500" style="Table1"> rml +="""<blockTable colWidths=" """ + str(colWidths) + """ " style="Table51"><tr>"""
<tr> <td> <para style="response">No Response</para></td> </tr> table_data = col_heading.browse(cr, uid, col_heading.search(cr, uid, [('response_table_id', '=', answer[0].id),('name','=',row)]))
</blockTable>""" for column in matrix_ans:
elif que.type in ['multiple_choice_only_one_ans','multiple_choice_multiple_ans']: value = """<font color="white"> </font>"""
if len(answer) and answer[0].state == "done": for col in table_data:
for ans in answer[0].response_answer_ids: if column == col.column_id.title:
value = col.value
rml += """<td> <para style="terp_default_9">""" + to_xml(tools.ustr(value)) +"""</para></td>"""
rml += """</tr></blockTable>"""
else:
rml +="""<blockTable colWidths="500" style="Table1"> rml +="""<blockTable colWidths="500" style="Table1">
<tr> <td> <para style="response">""" + to_xml(ans.answer_id.answer) + """</para></td></tr> <tr> <td> <para style="response">No Response</para></td> </tr>
</blockTable>"""
if que.comment_field_type:
rml+="""<blockTable colWidths="500" style="Table1"><tr>
<td><para style="answer">""" + tools.ustr(answer[0].comment) + """</para></td></tr></blockTable>"""
else:
rml +="""<blockTable colWidths="500" style="Table1">
<tr> <td> <para style="response">No Response</para></td> </tr>
</blockTable>"""
elif que.type in ['multiple_textboxes','date','date_and_time','numerical_textboxes']:
if len(answer) and answer[0].state == "done":
for ans in answer[0].response_answer_ids:
rml +="""<blockTable colWidths="200,300" style="Table1">
<tr> <td> <para style="response">""" + to_xml(ans.answer_id.answer) + """</para></td>
<td> <para style="response">""" + to_xml(ans.answer) + """</para></td></tr>
</blockTable>"""
else:
rml +="""<blockTable colWidths="500" style="Table1">
<tr> <td> <para style="response">No Response</para></td> </tr>
</blockTable>"""
elif que.type in ['single_textbox']:
if len(answer) and answer[0].state == "done":
rml +="""<blockTable colWidths="500" style="Table1">
<tr> <td> <para style="response">""" + to_xml(answer[0].single_text) + """</para></td></tr>
</blockTable>""" </blockTable>"""
else: elif que.type in ['multiple_choice_only_one_ans','multiple_choice_multiple_ans']:
rml +="""<blockTable colWidths="500" style="Table1"> if len(answer) and answer[0].state == "done":
<tr> <td> <para style="response">No Response</para></td> </tr> for ans in answer[0].response_answer_ids:
</blockTable>""" rml +="""<blockTable colWidths="500" style="Table1">
elif que.type in ['comment']: <tr> <td> <para style="response">""" + to_xml(tools.ustr(ans.answer_id.answer)) + """</para></td></tr>
if len(answer) and answer[0].state == "done": </blockTable>"""
rml +="""<blockTable colWidths="500" style="Table1"> if que.comment_field_type:
<tr> <td> <para style="response">""" + to_xml(answer[0].comment) + """</para></td></tr> if answer[0].comment:
rml+="""<blockTable colWidths="500" style="Table1"><tr>
<td><para style="answer">""" + to_xml(tools.ustr(answer[0].comment)) + """</para></td></tr></blockTable>"""
else:
rml +="""<blockTable colWidths="500" style="Table1">
<tr> <td> <para style="response">No Response</para></td> </tr>
</blockTable>""" </blockTable>"""
else: elif que.type in ['multiple_textboxes','date','date_and_time','numerical_textboxes']:
rml +="""<blockTable colWidths="500" style="Table1"> if len(answer) and answer[0].state == "done":
<tr> <td> <para style="response">No Response</para></td> </tr> for ans in answer[0].response_answer_ids:
</blockTable>""" rml +="""<blockTable colWidths="200,300" style="Table1">
elif que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','rating_scale','matrix_of_drop_down_menus']: <tr> <td> <para style="response">""" + to_xml(tools.ustr(ans.answer_id.answer)) + """</para></td>
if len(answer) and answer[0].state == "done": <td> <para style="response">""" + to_xml(tools.ustr(ans.answer)) + """</para></td></tr>
if que.comment_column: </blockTable>"""
pass else:
cols_widhts = [] rml +="""<blockTable colWidths="500" style="Table1">
cols_widhts.append(200) <tr> <td> <para style="response">No Response</para></td> </tr>
len_col_heading = len(que.column_heading_ids) </blockTable>"""
for col in range(0, len_col_heading): elif que.type in ['single_textbox']:
cols_widhts.append(float(300 / len_col_heading)) if len(answer) and answer[0].state == "done":
tmp=0.0 rml +="""<blockTable colWidths="500" style="Table1">
sum = 0.0 <tr> <td> <para style="response">""" + to_xml(tools.ustr(answer[0].single_text)) + """</para></td></tr>
i = 0 </blockTable>"""
if que.comment_column: else:
for col in cols_widhts: rml +="""<blockTable colWidths="500" style="Table1">
if i==0: <tr> <td> <para style="response">No Response</para></td> </tr>
cols_widhts[i] = cols_widhts[i]/2.0 </blockTable>"""
tmp = cols_widhts[i] elif que.type in ['comment']:
sum += col if len(answer) and answer[0].state == "done":
i+=1 rml +="""<blockTable colWidths="500" style="Table1">
cols_widhts.append(round(tmp,2)) <tr> <td> <para style="response">""" + to_xml(tools.ustr(answer[0].comment)) + """</para></td></tr>
colWidths = ",".join(map(tools.ustr, cols_widhts)) </blockTable>"""
matrix_ans = ['',] else:
for col in que.column_heading_ids: rml +="""<blockTable colWidths="500" style="Table1">
if col.title not in matrix_ans: <tr> <td> <para style="response">No Response</para></td> </tr>
matrix_ans.append(col.title) </blockTable>"""
len_matrix = len(matrix_ans) elif que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','rating_scale','matrix_of_drop_down_menus']:
if que.comment_column: if len(answer) and answer[0].state == "done":
matrix_ans.append(que.column_name)
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
for mat_col in matrix_ans:
rml+="""<td><para style="response">""" + to_xml(mat_col) + """</para></td>"""
rml +="""</tr>"""
rml+="""</blockTable>"""
i=0
for ans in que.answer_choice_ids:
if i%2!=0:
style='ans_tbl_white'
else:
style='ans_tbl_gainsboro'
i+=1
rml+="""<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'>
<tr><td><para style="response">""" + to_xml(ans.answer) + """</para></td>"""
comment_value = ""
for mat_col in range(1, len_matrix):
value = """"""
for res_ans in answer[0].response_answer_ids:
if res_ans.answer_id.id == ans.id and res_ans.answer == matrix_ans[mat_col]:
comment_value = to_xml(tools.ustr(res_ans.comment_field))
if que.type in ['matrix_of_drop_down_menus']:
value = """<para style="response">""" + to_xml(tools.ustr(res_ans.value_choice)) + """</para>"""
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
value = """<illustration><fill color="white"/>
<circle x="0.3cm" y="-0.18cm" radius="0.22 cm" fill="yes" stroke="yes"/>
<fill color="gray"/>
<circle x="0.3cm" y="-0.18cm" radius="0.10 cm" fill="yes" stroke="no"/>
</illustration>"""
elif que.type in ['matrix_of_choices_only_multi_ans']:
value = """<illustration>
<fill color="white"/>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>
<fill color="gray"/>
<rect x="0.2cm" y="-0.35cm" width="0.3 cm" height="0.3cm" fill="yes" stroke="no" round="0.1cm"/>
</illustration>"""
break
else:
if que.type in ['matrix_of_drop_down_menus']:
value = """"""
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
value = """<illustration><fill color="white"/>
<circle x="0.3cm" y="-0.18cm" radius="0.22 cm" fill="yes" stroke="yes" round="0.1cm"/>
</illustration>"""
elif que.type in ['matrix_of_choices_only_multi_ans']:
value = """<illustration><fill color="white"/>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>
</illustration>"""
rml+= """<td>""" + value + """</td>"""
if que.comment_column: if que.comment_column:
if comment_value=='False': pass
comment_value = '' cols_widhts = []
rml+= """<td><para style="response">"""+ comment_value + """</para></td>""" cols_widhts.append(200)
rml+=""" </tr></blockTable>""" len_col_heading = len(que.column_heading_ids)
if que.comment_field_type: for col in range(0, len_col_heading):
rml+="""<blockTable colWidths="500" style="Table1"><tr> cols_widhts.append(float(300 / len_col_heading))
<td><para style="answer">""" + tools.ustr(answer[0].comment) + """</para></td></tr></blockTable>""" tmp=0.0
else: sum = 0.0
rml +="""<blockTable colWidths="500" style="Table1"> i = 0
<tr> <td> <para style="response">No Response</para></td> </tr> if que.comment_column:
</blockTable>""" for col in cols_widhts:
rml += """<pageBreak/>""" if i==0:
cols_widhts[i] = cols_widhts[i]/2.0
tmp = cols_widhts[i]
sum += col
i+=1
cols_widhts.append(round(tmp,2))
colWidths = ",".join(map(tools.ustr, cols_widhts))
matrix_ans = ['',]
for col in que.column_heading_ids:
if col.title not in matrix_ans:
matrix_ans.append(col.title)
len_matrix = len(matrix_ans)
if que.comment_column:
matrix_ans.append(que.column_name)
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
for mat_col in matrix_ans:
rml+="""<td><para style="response">""" + to_xml(tools.ustr(mat_col)) + """</para></td>"""
rml +="""</tr>"""
rml+="""</blockTable>"""
i=0
for ans in que.answer_choice_ids:
if i%2!=0:
style='ans_tbl_white'
else:
style='ans_tbl_gainsboro'
i+=1
rml+="""<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'>
<tr><td><para style="response">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
comment_value = ""
for mat_col in range(1, len_matrix):
value = """"""
for res_ans in answer[0].response_answer_ids:
if res_ans.answer_id.id == ans.id and res_ans.answer == matrix_ans[mat_col]:
comment_value = to_xml(tools.ustr(res_ans.comment_field))
if que.type in ['matrix_of_drop_down_menus']:
value = """<para style="response">""" + to_xml(tools.ustr(res_ans.value_choice)) + """</para>"""
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
value = """<illustration><fill color="white"/>
<circle x="0.3cm" y="-0.18cm" radius="0.22 cm" fill="yes" stroke="yes"/>
<fill color="gray"/>
<circle x="0.3cm" y="-0.18cm" radius="0.10 cm" fill="yes" stroke="no"/>
</illustration>"""
elif que.type in ['matrix_of_choices_only_multi_ans']:
value = """<illustration>
<fill color="white"/>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>
<fill color="gray"/>
<rect x="0.2cm" y="-0.35cm" width="0.3 cm" height="0.3cm" fill="yes" stroke="no" round="0.1cm"/>
</illustration>"""
break
else:
if que.type in ['matrix_of_drop_down_menus']:
value = """"""
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
value = """<illustration><fill color="white"/>
<circle x="0.3cm" y="-0.18cm" radius="0.22 cm" fill="yes" stroke="yes" round="0.1cm"/>
</illustration>"""
elif que.type in ['matrix_of_choices_only_multi_ans']:
value = """<illustration><fill color="white"/>
<rect x="0.1cm" y="-0.45cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>
</illustration>"""
rml+= """<td>""" + value + """</td>"""
if que.comment_column:
if comment_value=='False':
comment_value = ''
rml+= """<td><para style="response">"""+ to_xml(tools.ustr(comment_value)) + """</para></td>"""
rml+=""" </tr></blockTable>"""
if que.comment_field_type:
rml+="""<blockTable colWidths="500" style="Table1"><tr>
<td><para style="answer">""" + to_xml(tools.ustr(answer[0].comment)) + """</para></td></tr></blockTable>"""
else:
rml +="""<blockTable colWidths="500" style="Table1">
<tr> <td> <para style="response">No Response</para></td> </tr>
</blockTable>"""
rml += """<pageBreak/>"""
rml += """</story></document>""" rml += """</story></document>"""
report_type = datas.get('report_type', 'pdf') report_type = datas.get('report_type', 'pdf')
create_doc = self.generators[report_type] create_doc = self.generators[report_type]

View File

@ -142,21 +142,21 @@ class survey_form(report_rml):
if datas.has_key('form') and datas['form']['survey_title']: if datas.has_key('form') and datas['form']['survey_title']:
rml += """ rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl"> <blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
<tr><td><para style="title">""" + to_xml(survey.title) + """</para><para style="P2"><font></font></para></td></tr> <tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>""" </blockTable>"""
seq = 0 seq = 0
for page in survey.page_ids: for page in survey.page_ids:
seq+=1 seq+=1
rml += """ rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="page_tbl"> <blockTable colWidths='"""+_tbl_widths+"""' style="page_tbl">
<tr><td><para style="page">"""+ tools.ustr(seq) + """. """ + tools.ustr(page.title) + """</para></td></tr> <tr><td><para style="page">"""+ tools.ustr(seq) + """. """ + to_xml(tools.ustr(page.title)) + """</para></td></tr>
</blockTable>""" </blockTable>"""
for que in page.question_ids: for que in page.question_ids:
cols_widhts=[] cols_widhts=[]
rml +=""" rml +="""
<para style="P2"><font></font></para> <para style="P2"><font></font></para>
<blockTable colWidths='"""+_tbl_widths+"""' style="question_tbl"> <blockTable colWidths='"""+_tbl_widths+"""' style="question_tbl">
<tr><td><para style="question">""" + tools.ustr(prefix) + tools.ustr(que.question) + """</para></td></tr> <tr><td><para style="question">""" + to_xml(tools.ustr(prefix)) + to_xml(tools.ustr(que.question)) + """</para></td></tr>
</blockTable> </blockTable>
<para style="P2"><font></font></para>""" <para style="P2"><font></font></para>"""
if que.type in ['descriptive_text']: if que.type in ['descriptive_text']:
@ -246,14 +246,14 @@ class survey_form(report_rml):
if col.title not in matrix_ans: if col.title not in matrix_ans:
matrix_ans.append(col.title) matrix_ans.append(col.title)
if que.comment_column: if que.comment_column:
matrix_ans.append(tools.ustr(que.column_name)) matrix_ans.append(to_xml(tools.ustr(que.column_name)))
rml+=""" rml+="""
<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl"> <blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
<tr>""" <tr>"""
for mat_col in matrix_ans: for mat_col in matrix_ans:
rml+=""" rml+="""
<td><para style="response">""" + to_xml(mat_col) + """</para></td>""" <td><para style="response">""" + to_xml(tools.ustr(mat_col)) + """</para></td>"""
rml+="""</tr></blockTable>""" rml+="""</tr></blockTable>"""
i=0 i=0
for ans in que.answer_choice_ids: for ans in que.answer_choice_ids:
@ -346,7 +346,7 @@ class survey_form(report_rml):
colWidths = colWidths+'cm' colWidths = colWidths+'cm'
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table4"><tr>""" rml+="""<blockTable colWidths=" """ + colWidths + """ " style="Table4"><tr>"""
for col in que.column_heading_ids: for col in que.column_heading_ids:
rml+="""<td><para style="terp_tblheader_Details">""" + tools.ustr(col.title) + """</para></td>""" rml+="""<td><para style="terp_tblheader_Details">""" + to_xml(tools.ustr(col.title)) + """</para></td>"""
rml+="""</tr></blockTable> rml+="""</tr></blockTable>
<blockTable colWidths=" """ + colWidths + """ " style="Table5">""" <blockTable colWidths=" """ + colWidths + """ " style="Table5">"""
for r in range(0,que.no_of_rows): for r in range(0,que.no_of_rows):

View File

@ -30,6 +30,7 @@ from lxml import etree
from tools import to_xml from tools import to_xml
import tools import tools
from mx.DateTime import * from mx.DateTime import *
import netsvc
class survey(osv.osv): class survey(osv.osv):
_name = 'survey' _name = 'survey'
@ -795,6 +796,34 @@ class survey_question_wiz(osv.osv_memory):
else: else:
if not context.has_key('active'): if not context.has_key('active'):
survey_obj.write(cr, uid, survey_id, {'tot_comp_survey' : sur_rec['tot_comp_survey'] + 1}) survey_obj.write(cr, uid, survey_id, {'tot_comp_survey' : sur_rec['tot_comp_survey'] + 1})
surv_name_wiz = self.pool.get('survey.name.wiz')
user_obj = self.pool.get('res.users')
survey_data = self.pool.get('survey').browse(cr, uid, int(context['survey_id']))
response_id = surv_name_wiz.read(cr,uid,context['sur_name_id'])['response']
context.update({'response_id':response_id})
report = self.create_report(cr, uid, [int(context.get('survey_id',False))], 'report.survey.browse.response', survey_data.title,context)
attachments = []
file = open("/tmp/" + survey_data.title + ".pdf")
file_data = ""
while 1:
line = file.readline()
file_data += line
if not line:
break
attachments.append((survey_data.title + ".pdf",file_data))
user_email = False
resp_email = False
if user_obj.browse(cr, uid, uid).address_id.id:
cr.execute("select email from res_partner_address where id =%d" % user_obj.browse(cr, uid, uid).address_id.id)
user_email = cr.fetchone()[0]
resp_id = survey_data.responsible_id.address_id
if resp_id:
cr.execute("select email from res_partner_address where id =%d" % resp_id.id)
resp_email = cr.fetchone()[0]
if user_email and resp_email:
mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_obj.browse(cr, uid, uid).name) + " Give Response Of " + survey_data.title + " Survey.\n\n Thanks,"
tools.email_send(user_email, [resp_email], "Survey Response Of " + str(user_obj.browse(cr, uid, uid).name) , mail, attach = attachments)
xml_form = etree.Element('form', {'string': _('Complete Survey Response')}) xml_form = etree.Element('form', {'string': _('Complete Survey Response')})
etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"}) 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 response'})
@ -806,6 +835,21 @@ class survey_question_wiz(osv.osv_memory):
result['context'] = context result['context'] = context
return result return result
def create_report(self, cr, uid, res_ids, report_name=False, file_name=False, context=None):
if not report_name or not res_ids:
return (False, Exception('Report name and Resources ids are required !!!'))
try:
ret_file_name = '/tmp/'+file_name+'.pdf'
service = netsvc.LocalService(report_name);
(result, format) = service.create(cr, uid, res_ids, {}, context)
fp = open(ret_file_name, 'wb+');
fp.write(result);
fp.close();
except Exception,e:
print 'Exception in create report:',e
return (False, str(e))
return (True, ret_file_name)
def default_get(self, cr, uid, fields_list, context=None): def default_get(self, cr, uid, fields_list, context=None):
value = {} value = {}
for field in fields_list: for field in fields_list:

View File

@ -212,7 +212,7 @@
<field name="page_id" ref="survey_page_Contracts" /> <field name="page_id" ref="survey_page_Contracts" />
<field name="type">multiple_choice_only_one_ans</field> <field name="type">multiple_choice_only_one_ans</field>
<field name="comment_field_type">text</field> <field name="comment_field_type">text</field>
<field name="comment_label">Never... Why?</field> <field name="comment_label">Why?</field>
<field name="in_visible_single_text">1</field> <field name="in_visible_single_text">1</field>
<field eval="2" name="sequence"/> <field eval="2" name="sequence"/>
</record> </record>
@ -226,9 +226,12 @@
<field name="question_id" ref="survey_question_contract_customers" /> <field name="question_id" ref="survey_question_contract_customers" />
<field name="sequence" eval="2"/> <field name="sequence" eval="2"/>
</record> </record>
<record id="survey_answer_never" model="survey.answer">
<field name="answer">Never... </field>
<field name="question_id" ref="survey_question_contract_customers" />
<field name="sequence" eval="2"/>
</record>
<record id="survey_question_contract_customers" model="survey.question"> <record id="survey_question_contract_customers" model="survey.question">
<field name="make_comment_field">True</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field eval="True" name="is_require_answer"/> <field eval="True" name="is_require_answer"/>
</record> </record>
@ -767,8 +770,6 @@
<field name="sequence" eval="2"/> <field name="sequence" eval="2"/>
</record> </record>
<record id="survey_question_odoo_continue_using_odoo" model="survey.question"> <record id="survey_question_odoo_continue_using_odoo" model="survey.question">
<field name="make_comment_field">True</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field eval="True" name="is_require_answer"/> <field eval="True" name="is_require_answer"/>
</record> </record>
@ -985,12 +986,12 @@
<field name="page_id" ref="survey_page_odoo_the_offer" /> <field name="page_id" ref="survey_page_odoo_the_offer" />
<field name="type">multiple_choice_only_one_ans</field> <field name="type">multiple_choice_only_one_ans</field>
<field name="comment_field_type">text</field> <field name="comment_field_type">text</field>
<field name="comment_label">Yes, I plan to use (GB) :</field> <field name="comment_label">Comment</field>
<field name="in_visible_single_text">1</field> <field name="in_visible_single_text">1</field>
<field name="sequence" eval="2"/> <field name="sequence" eval="2"/>
</record> </record>
<record id="survey_answer_YES" model="survey.answer"> <record id="survey_answer_YES" model="survey.answer">
<field name="answer">YES</field> <field name="answer">Yes, I plan to use (GB)</field>
<field name="question_id" ref="survey_question_odoo_dms" /> <field name="question_id" ref="survey_question_odoo_dms" />
<field name="sequence" eval="1"/> <field name="sequence" eval="1"/>
</record> </record>
@ -999,10 +1000,7 @@
<field name="question_id" ref="survey_question_odoo_dms" /> <field name="question_id" ref="survey_question_odoo_dms" />
<field name="sequence" eval="2"/> <field name="sequence" eval="2"/>
</record> </record>
<record id="survey_question_odoo_dms" model="survey.question"> <record id="survey_question_odoo_dms" model="survey.question">
<field name="make_comment_field">True</field>
<field name="make_comment_field_err_msg">Please enter a comment.</field>
<field eval="True" name="is_require_answer"/> <field eval="True" name="is_require_answer"/>
</record> </record>

View File

@ -79,7 +79,7 @@
<field name="comment_valid_err_msg" nolabel="1" colspan="4"/> <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
</group> </group>
</group> </group>
<group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}"> <!-- group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}">
<group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}"> <group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
<field name="make_comment_field"/> <field name="make_comment_field"/>
<group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}"> <group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}">
@ -87,7 +87,7 @@
<field name="make_comment_field_err_msg" nolabel="1"/> <field name="make_comment_field_err_msg" nolabel="1"/>
</group> </group>
</group> </group>
</group> </group-->
<group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}"> <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
<field name="comment_column"/> <field name="comment_column"/>
<group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}"> <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">
@ -315,7 +315,7 @@
<field name="comment_valid_err_msg" nolabel="1" colspan="4"/> <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
</group> </group>
</group> </group>
<group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}"> <!--group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}">
<group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}"> <group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
<field name="make_comment_field"/> <field name="make_comment_field"/>
<group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}"> <group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}">
@ -323,7 +323,7 @@
<field name="make_comment_field_err_msg" nolabel="1"/> <field name="make_comment_field_err_msg" nolabel="1"/>
</group> </group>
</group> </group>
</group> </group-->
<group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}"> <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
<field name="comment_column"/> <field name="comment_column"/>
<group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}"> <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">
@ -499,7 +499,7 @@
<field name="comment_valid_err_msg" nolabel="1" colspan="4"/> <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
</group> </group>
</group> </group>
<group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}"> <!--group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}">
<group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}"> <group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
<field name="make_comment_field"/> <field name="make_comment_field"/>
<group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}"> <group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}">
@ -507,7 +507,7 @@
<field name="make_comment_field_err_msg" nolabel="1"/> <field name="make_comment_field_err_msg" nolabel="1"/>
</group> </group>
</group> </group>
</group> </group-->
<group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}"> <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
<field name="comment_column"/> <field name="comment_column"/>
<group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}"> <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">
@ -636,7 +636,7 @@
<field name="comment_valid_err_msg" nolabel="1" colspan="4"/> <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
</group> </group>
</group> </group>
<group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}"> <!--group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans')]}">
<group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}"> <group colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
<field name="make_comment_field"/> <field name="make_comment_field"/>
<group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}"> <group colspan="4" attrs="{'invisible':[('make_comment_field','!=',True)]}">
@ -644,7 +644,7 @@
<field name="make_comment_field_err_msg" nolabel="1"/> <field name="make_comment_field_err_msg" nolabel="1"/>
</group> </group>
</group> </group>
</group> </group-->
<group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}"> <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
<field name="comment_column"/> <field name="comment_column"/>
<group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}"> <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">