diff --git a/addons/survey/report/survey_analysis_report.py b/addons/survey/report/survey_analysis_report.py index b4e7765346c..f7f08df3d65 100644 --- a/addons/survey/report/survey_analysis_report.py +++ b/addons/survey/report/survey_analysis_report.py @@ -330,54 +330,6 @@ class survey_analysis(report_rml): """ + tools.ustr(res_count) + """""" rml += """""" - elif que.type in['matrix_of_drop_down_menus']: - for column in que.column_heading_ids: - rml += """ - """ + to_xml(tools.ustr(column.title)) + """""" - menu_choices = column.menu_choice.split('\n') - cols_widhts = [] - cols_widhts.append(200) - for col in range(0, len(menu_choices) + 1): - cols_widhts.append(float(300 / (len(menu_choices) + 1))) - colWidths = ",".join(map(tools.ustr, cols_widhts)) - rml += """ - """ - - for menu in menu_choices: - rml += """""" + to_xml(tools.ustr(menu)) + """""" - rml += """Answer Count""" - 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() - cr.execute("select count(sra.id),sra.value_choice, sra.answer_id, sra.column_id from survey_response_answer sra \ - where sra.column_id='%s' group by sra.value_choice ,sra.answer_id, sra.column_id", (column.id,)) - calc_percantage = cr.dictfetchall() - - for ans in que.answer_choice_ids: - rml += """""" + to_xml(tools.ustr(ans.answer)) + """""" - for mat_col in range(0, len(menu_choices)): - calc = 0 - response = 0 - for res in res_count: - if res['answer_id'] == ans.id: response = res['count'] - for per in calc_percantage: - if ans.id == per['answer_id'] and menu_choices[mat_col] == per['value_choice']: - calc = per['count'] - percantage = 0.00 - - if calc and response: - percantage = round((float(calc)* 100) / response,2) - if calc: - rml += """""" +tools.ustr(percantage)+"% (" + tools.ustr(calc) + """)""" - else: - rml += """""" +tools.ustr(percantage)+"% (" + tools.ustr(calc) + """)""" - - response = 0 - for res in res_count: - if res['answer_id'] == ans.id: response = res['count'] - rml += """""" + tools.ustr(response) + """""" - rml += """""" - elif que.type in['numerical_textboxes']: rml += """ diff --git a/addons/survey/report/survey_browse_response.py b/addons/survey/report/survey_browse_response.py index f910140727d..507d7275c17 100644 --- a/addons/survey/report/survey_browse_response.py +++ b/addons/survey/report/survey_browse_response.py @@ -423,7 +423,7 @@ class survey_browse_response(report_rml): No Answer """ - elif que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans', 'rating_scale', 'matrix_of_drop_down_menus']: + elif que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans', 'rating_scale']: if len(answer) and answer[0].state == "done": if que.type in ['matrix_of_choices_only_one_ans', 'rating_scale'] and que.comment_column: pass @@ -478,9 +478,7 @@ class survey_browse_response(report_rml): for res_ans in answer[0].response_answer_ids: 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)) + """""" - elif que.type in ['matrix_of_choices_only_one_ans', 'rating_scale']: + if que.type in ['matrix_of_choices_only_one_ans', 'rating_scale']: value = """ @@ -495,9 +493,7 @@ class survey_browse_response(report_rml): """ break else: - if que.type in ['matrix_of_drop_down_menus']: - value = """""" - elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']: + if que.type in ['matrix_of_choices_only_one_ans','rating_scale']: value = """ """ diff --git a/addons/survey/report/survey_form.py b/addons/survey/report/survey_form.py index 8375df6acaf..e6c50947327 100644 --- a/addons/survey/report/survey_form.py +++ b/addons/survey/report/survey_form.py @@ -244,7 +244,7 @@ class survey_form(report_rml): rml += """ """ - elif que.type in ['matrix_of_choices_only_one_ans','rating_scale','matrix_of_choices_only_multi_ans','matrix_of_drop_down_menus']: + elif que.type in ['matrix_of_choices_only_one_ans','rating_scale','matrix_of_choices_only_multi_ans']: if len(que.column_heading_ids): cols_widhts.append(float(_tbl_widths.replace('cm',''))/float(2.0)) for col in que.column_heading_ids: @@ -290,10 +290,7 @@ class survey_form(report_rml): rec_width = float((sum-tmp)*10+100) value = "" - if que.type in ['matrix_of_drop_down_menus']: - value = """ - """ - elif que.type in ['matrix_of_choices_only_one_ans','rating_scale']: + if que.type in ['matrix_of_choices_only_one_ans','rating_scale']: value = """ """ else: diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 241b9739016..be9003c805d 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -303,7 +303,6 @@ class survey_question(osv.osv): ('multiple_choice_multiple_ans','Multiple Choice (Multiple Answer)'), ('matrix_of_choices_only_one_ans','Matrix of Choices (Only One Answers Per Row)'), ('matrix_of_choices_only_multi_ans','Matrix of Choices (Multiple Answers Per Row)'), - ('matrix_of_drop_down_menus','Matrix of Drop-down Menus'), ('rating_scale','Rating Scale'),('single_textbox','Single Textbox'), ('multiple_textboxes','Multiple Textboxes'), ('multiple_textboxes_diff_type','Multiple Textboxes With Different Type'), @@ -388,10 +387,6 @@ class survey_question(osv.osv): val.update({'in_visible_rating_weight':False, 'in_visible_menu_choice':True}) return {'value': val} - elif type in ['matrix_of_drop_down_menus']: - val.update({'in_visible_rating_weight':True, 'in_visible_menu_choice':False}) - return {'value': val} - elif type in ['single_textbox']: val.update({'in_visible_rating_weight':True, 'in_visible_menu_choice':True}) return {'value': val} @@ -418,8 +413,7 @@ class survey_question(osv.osv): else: que_type = question['type'] - if que_type in ['matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans',\ - 'matrix_of_drop_down_menus', 'rating_scale']: + if que_type in ['matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'rating_scale']: if not col_len: raise osv.except_osv(_('Warning!'),_('You must enter one or more column headings for question "%s" of page %s.') % (question['question'], question['page_id'][1])) ans_len = len(question['answer_choice_ids']) @@ -442,8 +436,8 @@ class survey_question(osv.osv): req_type = question['required_type'] if que_type in ['multiple_choice_multiple_ans','matrix_of_choices_only_one_ans', \ - 'matrix_of_choices_only_multi_ans', 'matrix_of_drop_down_menus',\ - 'rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time']: + 'matrix_of_choices_only_multi_ans', 'rating_scale','multiple_textboxes', \ + 'numerical_textboxes','date','date_and_time']: if req_type in ['at least', 'at most', 'exactly']: if vals.has_key('req_ans'): if not vals['req_ans'] or vals['req_ans'] > ans_len: @@ -487,16 +481,6 @@ class survey_question(osv.osv): raise osv.except_osv(_('Warning!'),_("Maximum Required Answer is greater \ than Minimum Required Answer")) - if question['type'] == 'matrix_of_drop_down_menus' and vals.has_key('column_heading_ids'): - for col in vals['column_heading_ids']: - if not col[2] or not col[2].has_key('menu_choice') or not col[2]['menu_choice']: - raise osv.except_osv(_('Warning!'),_("You must enter one or more menu choices\ - in column heading.")) - elif not col[2] or not col[2].has_key('menu_choice') or\ - col[2]['menu_choice'].strip() == '': - raise osv.except_osv(_('Warning!'),_("You must enter one or more menu \ - choices in column heading (white spaces not allowed).")) - return super(survey_question, self).write(cr, uid, ids, vals, context=context) def create(self, cr, uid, vals, context=None): @@ -508,10 +492,10 @@ class survey_question(osv.osv): raise osv.except_osv(_('Warning!'),_('You must enter one or more answers for question "%s" of page %s .') % (vals['question'], page)) if vals.has_key('column_heading_ids') and not len(vals['column_heading_ids']): - if vals.has_key('type') and vals['type'] in ['matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'matrix_of_drop_down_menus', 'rating_scale']: + if vals.has_key('type') and vals['type'] in ['matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'rating_scale']: raise osv.except_osv(_('Warning!'),_('You must enter one or more column headings for question "%s" of page %s.')% (vals['question'], page)) - if vals['type'] in ['multiple_choice_multiple_ans','matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'matrix_of_drop_down_menus', 'rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time']: + if vals['type'] in ['multiple_choice_multiple_ans','matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time']: if vals.has_key('is_require_answer') and vals.has_key('required_type') and vals['required_type'] in ['at least', 'at most', 'exactly']: if vals.has_key('answer_choice_ids') and vals['req_ans'] > len(vals['answer_choice_ids']) or not vals['req_ans']: raise osv.except_osv(_('Warning!'),_("#Required Answer you entered is greater than the number of answer. Please use a number that is smaller than %d.") % (len(vals['answer_choice_ids'])+1)) @@ -526,13 +510,6 @@ class survey_question(osv.osv): if maximum_ans <= minimum_ans: raise osv.except_osv(_('Warning!'),_("Maximum Required Answer is greater than Minimum Required Answer.")) - if vals['type'] == 'matrix_of_drop_down_menus': - for col in vals['column_heading_ids']: - if not col[2] or not col[2].has_key('menu_choice') or not col[2]['menu_choice']: - raise osv.except_osv(_('Warning!'),_("You must enter one or more menu choices in column heading.")) - elif not col[2] or not col[2].has_key('menu_choice') or col[2]['menu_choice'].strip() == '': - raise osv.except_osv(_('Warning!'),_("You must enter one or more menu choices in column heading (white spaces not allowed).")) - res = super(survey_question, self).create(cr, uid, vals, context) return res diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 7da3f26fc2f..639b5aec649 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -82,11 +82,11 @@ - + - + @@ -94,7 +94,7 @@ - + @@ -161,12 +161,12 @@ - + - + @@ -318,7 +318,12 @@ /
- Answer Survey + @@ -395,11 +400,11 @@ - + - + @@ -407,7 +412,7 @@ - + @@ -473,12 +478,12 @@ - + - + @@ -603,12 +608,12 @@ - + - + @@ -616,7 +621,7 @@ - + @@ -683,12 +688,12 @@ - + - + @@ -780,12 +785,12 @@ - + - + @@ -793,7 +798,7 @@ - + @@ -860,12 +865,12 @@ - + - + @@ -1037,25 +1042,6 @@ Survey Response Answer --> - - survey_response_answer_form - survey.response.answer - -
- - - - - -
-
- survey_response_answer_tree survey.response.answer diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index d935eb92ade..6c3604e22c3 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -257,21 +257,6 @@ class survey_question_wiz(osv.osv_memory): etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_" + tools.ustr(row.id) + "_" + tools.ustr(col.id), 'nolabel':"1"}) fields[tools.ustr(que.id) + "_" + tools.ustr(row.id) + "_" + tools.ustr(col.id)] = {'type':'boolean', 'string': col.title} - elif que_rec.type == 'matrix_of_drop_down_menus': - xml_group = etree.SubElement(xml_group, 'group', {'col': str(len(que_rec.column_heading_ids) + 1), 'colspan': '4'}) - etree.SubElement(xml_group, 'separator', {'string': '.','colspan': '1'}) - for col in que_rec.column_heading_ids: - etree.SubElement(xml_group, 'separator', {'string': tools.ustr(col.title),'colspan': '1'}) - for row in ans_ids: - etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(row.answer))+' :-', 'align': '0.0'}) - for col in que_rec.column_heading_ids: - selection = [] - if col.menu_choice: - for item in col.menu_choice.split('\n'): - if item and not item.strip() == '': selection.append((item ,item)) - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_" + tools.ustr(row.id) + "_" + tools.ustr(col.id),'nolabel':'1'}) - fields[tools.ustr(que.id) + "_" + tools.ustr(row.id) + "_" + tools.ustr(col.id)] = {'type':'selection', 'string': col.title, 'selection':selection} - elif que_rec.type == 'multiple_textboxes': xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'}) type = "char" @@ -348,7 +333,7 @@ class survey_question_wiz(osv.osv_memory): if item and not item.strip() == '': selection.append((item ,item)) fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"] = {'type':'selection', 'selection' : selection, 'string':ans.answer} - if que_rec.type in ['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans', 'matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'matrix_of_drop_down_menus', 'rating_scale'] and que_rec.is_comment_require: + if que_rec.type in ['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans', 'matrix_of_choices_only_one_ans', 'matrix_of_choices_only_multi_ans', 'rating_scale'] and que_rec.is_comment_require: if que_rec.type in ['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans'] and que_rec.comment_field_type in ['char','text'] and que_rec.make_comment_field: etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_otherfield", 'colspan':"4"}) fields[tools.ustr(que.id) + "_otherfield"] = {'type':'boolean', 'string':que_rec.comment_label, 'views':{}} @@ -807,7 +792,7 @@ class survey_question_wiz(osv.osv_memory): sur_name_read['store_ans'].pop(res) raise osv.except_osv(_('Warning!'), "'" + que_rec['question'] + "' " + tools.ustr(que_rec['numeric_required_sum_err_msg'])) - if que_rec['type'] in ['multiple_textboxes_diff_type', 'multiple_choice_multiple_ans','matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','matrix_of_drop_down_menus','rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time'] and que_rec['is_require_answer']: + if que_rec['type'] in ['multiple_textboxes_diff_type', 'multiple_choice_multiple_ans','matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time'] and que_rec['is_require_answer']: if matrix_list: if (que_rec['required_type'] == 'all' and len(list(set(matrix_list))) < len(que_rec['answer_choice_ids'])) or \ (que_rec['required_type'] == 'at least' and len(list(set(matrix_list))) < que_rec['req_ans']) or \ @@ -997,7 +982,7 @@ class survey_question_wiz(osv.osv_memory): if not select_count: resp_obj.write(cr, uid, update, {'state': 'skip'}) - if que_rec['type'] in ['multiple_textboxes_diff_type','multiple_choice_multiple_ans','matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','matrix_of_drop_down_menus','rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time'] and que_rec['is_require_answer']: + if que_rec['type'] in ['multiple_textboxes_diff_type','multiple_choice_multiple_ans','matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans','rating_scale','multiple_textboxes','numerical_textboxes','date','date_and_time'] and que_rec['is_require_answer']: if matrix_list: if (que_rec['required_type'] == 'all' and len(list(set(matrix_list))) < len(que_rec['answer_choice_ids'])) or \ (que_rec['required_type'] == 'at least' and len(list(set(matrix_list))) < que_rec['req_ans']) or \