""" + to_xml(tools.ustr(survey.title)) + """
@@ -239,25 +240,100 @@ class survey_browse_response(report_rml):
"""
elif que.type in ['multiple_choice_only_one_ans','multiple_choice_multiple_ans']:
if len(answer) and answer[0].state == "done":
+ ans_list = []
for ans in answer[0].response_answer_ids:
- rml +="""
- | """ + to_xml(tools.ustr(ans.answer_id.answer)) + """ |
- """
- if que.comment_field_type:
- if answer[0].comment:
- rml+="""
+ ans_list.append(to_xml(tools.ustr(ans.answer_id.answer)))
+
+ answer_choice=[]
+ _divide_columns_for_matrix = 20
+ _display_ans_in_rows = 5
+ _tbl_widths = 500
+ for ans in que['answer_choice_ids']:
+ answer_choice.append(to_xml(tools.ustr((ans.answer))))
+
+ def divide_list(lst, n):
+ return [lst[i::n] for i in range(n)]
+
+ divide_list = divide_list(answer_choice,_display_ans_in_rows)
+ for lst in divide_list:
+ if que.type == 'multiple_choice_multiple_ans':
+ if len(lst)<>0 and len(lst)<>int(round(float(len(answer_choice))/_display_ans_in_rows,0)):
+ lst.append('')
+ if not lst:
+ del divide_list[divide_list.index(lst):]
+ for divide in divide_list:
+ a = _divide_columns_for_matrix*len(divide)
+ b = float(_tbl_widths) - float(a)
+ cols_widhts=[]
+ for div in range(0,len(divide)):
+ cols_widhts.append(float(a/len(divide)))
+ cols_widhts.append(float(b/len(divide)))
+ colWidths = ",".join(map(tools.ustr, cols_widhts))
+ rml+="""
+ """
+ for div in range(0,len(divide)):
+ if divide[div]!='':
+ if que.type == 'multiple_choice_multiple_ans':
+ if divide[div] in ans_list:
+ rml += """|
+
+
+
+ |
+ """ + divide[div] + """ | """
+ else:
+ rml+="""
+
+
+
+
+ |
+ """ + divide[div] + """ | """
+ else:
+ if divide[div] in ans_list:
+ rml += """
+
+
+
+ |
+ """ + divide[div] + """ | """
+ else:
+ rml+="""
+
+
+
+
+ |
+ """ + divide[div] + """ | """
+ else:
+ rml+="""
+ |
+ | """
+ rml+=""" """
+ if que.is_comment_require and answer[0].comment:
+ rml+="""
| """ + to_xml(tools.ustr(answer[0].comment)) + """ | """
+
else:
rml +="""
| No Response |
"""
- elif que.type in ['multiple_textboxes','date','date_and_time','numerical_textboxes']:
+ elif que.type in ['multiple_textboxes_diff_type','multiple_textboxes','date','date_and_time','numerical_textboxes','multiple_textboxes_diff_type']:
if len(answer) and answer[0].state == "done":
+ answer_list = {}
for ans in answer[0].response_answer_ids:
- rml +="""
- | """ + to_xml(tools.ustr(ans.answer_id.answer)) + """ |
- """ + to_xml(tools.ustr(ans.answer)) + """ |
- """
+ answer_list[ans.answer_id.answer] = ans.answer
+ for que_ans in que['answer_choice_ids']:
+ if que_ans.answer in answer_list:
+ rml +="""
+ | """ + to_xml(tools.ustr(que_ans.answer)) + """ |
+ """ + to_xml(tools.ustr(answer_list[que_ans.answer])) + """ |
+ """
+ else:
+ rml +="""
+ | """ + to_xml(tools.ustr(que_ans.answer)) + """ |
+ |
+ """
else:
rml +="""
| No Response |
@@ -301,16 +377,16 @@ class survey_browse_response(report_rml):
i+=1
cols_widhts.append(round(tmp,2))
colWidths = ",".join(map(tools.ustr, cols_widhts))
- matrix_ans = ['',]
+ matrix_ans = [(0,''),]
for col in que.column_heading_ids:
if col.title not in matrix_ans:
- matrix_ans.append(col.title)
+ matrix_ans.append((col.id,col.title))
len_matrix = len(matrix_ans)
if que.type in ['matrix_of_choices_only_one_ans','rating_scale'] and que.comment_column:
matrix_ans.append(que.column_name)
rml+=""""""
- for mat_col in matrix_ans:
- rml+="""| """ + to_xml(tools.ustr(mat_col)) + """ | """
+ for mat_col in range(0, len(matrix_ans)):
+ rml+="""""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """ | """
rml +=""" """
rml+=""""""
i=0
@@ -326,7 +402,7 @@ class survey_browse_response(report_rml):
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]:
+ if res_ans.answer_id.id == ans.id and res_ans.column_id.id == matrix_ans[mat_col][0]:
comment_value = to_xml(tools.ustr(res_ans.comment_field))
if que.type in ['matrix_of_drop_down_menus']:
value = """""" + to_xml(tools.ustr(res_ans.value_choice)) + """"""
diff --git a/addons/survey/report/survey_form.py b/addons/survey/report/survey_form.py
index 0cdc9194c2a..84d6de286fb 100644
--- a/addons/survey/report/survey_form.py
+++ b/addons/survey/report/survey_form.py
@@ -288,16 +288,11 @@ class survey_form(report_rml):
else:
rml+="""""" + value + """ | """
rml+= """ """
- elif que.type in ['multiple_textboxes','numerical_textboxes', 'date_and_time','date']:
+ elif que.type in ['multiple_textboxes','numerical_textboxes', 'date_and_time','date','multiple_textboxes_diff_type']:
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
colWidths = tools.ustr(colWidths) + 'cm'
- rect_len = ""
- if que.type in ['multiple_textboxes']:
- rect_len = tools.ustr(cols_widhts[0] - 0.3) + "cm"
- else:
- rect_len = "6cm"
for ans in que.answer_choice_ids:
rml +="""
@@ -305,7 +300,7 @@ class survey_form(report_rml):
""" + to_xml(tools.ustr(ans.answer)) + """ |
-
+
|
|
@@ -313,14 +308,11 @@ class survey_form(report_rml):
elif que.type in ['comment']:
cols_widhts.append(float(_tbl_widths.replace('cm','')))
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
- colWidths = colWidths+'cm'
- rect_len = ""
- rect_len = tools.ustr(cols_widhts[0] - 0.4) + "cm"
- rml+="""