diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 4aa274a0a68..febd11a7747 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1419,7 +1419,8 @@ class virtual_report_spool(web_services.report_spool): new_ids = [] for id in ids: new_ids.append(base_calendar_id2real_id(id)) - datas['id'] = base_calendar_id2real_id(datas['id']) + if datas.get('id',False): + datas['id'] = base_calendar_id2real_id(datas['id']) return super(virtual_report_spool, self).exp_report(db, uid, object, new_ids, datas, context) virtual_report_spool() diff --git a/addons/survey/report/survey_browse_response.py b/addons/survey/report/survey_browse_response.py index 41c38ceef4d..48d56126a8f 100644 --- a/addons/survey/report/survey_browse_response.py +++ b/addons/survey/report/survey_browse_response.py @@ -445,7 +445,7 @@ class survey_browse_response(report_rml): 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) + matrix_ans.append((0,que.column_name)) rml += """""" for mat_col in range(0, len(matrix_ans)): diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 630b0a30c01..e6790427cb9 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -80,8 +80,6 @@ class survey_question_wiz(osv.osv_memory): context.pop('active_id') survey_id = context.get('survey_id', False) - #TODO: change to the browse, use read if only need to read few columns values - # this will fire select * from quary sur_rec = survey_obj.browse(cr, uid, survey_id) p_id = map(lambda x:x.id, sur_rec.page_ids) total_pages = len(p_id) @@ -132,8 +130,8 @@ class survey_question_wiz(osv.osv_memory): if sur_name_rec.page_no > 1: pre_button = True if flag: - pag_rec = page_obj.read(cr, uid, p_id) - xml_form = etree.Element('form', {'string': _(tools.ustr(pag_rec['title']))}) + pag_rec = page_obj.browse(cr, uid, p_id) + xml_form = etree.Element('form', {'string': _(tools.ustr(pag_rec.title))}) xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) if context.has_key('response_id') and context.get('response_id', False) and int(context.get('response_id',0)[0]) > 0: xml_group = etree.SubElement(xml_form, 'group', {'col': '40', 'colspan': '4'}) @@ -149,19 +147,19 @@ class survey_question_wiz(osv.osv_memory): fields["wizardid_" + str(wiz_id)] = {'type':'char', 'size' : 255, 'string':"", 'views':{}} etree.SubElement(xml_form, 'field', {'invisible':'1','name': "wizardid_" + str(wiz_id),'default':str(lambda *a: 0)}) - if pag_rec['note']: + if pag_rec.note: xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) - for que_test in pag_rec['note'].split('\n'): + for que_test in pag_rec.note.split('\n'): etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"}) - que_ids = pag_rec['question_ids'] + que_ids = pag_rec.question_ids qu_no = 0 for que in que_ids: qu_no += 1 - que_rec = que_obj.read(cr, uid, que) + que_rec = que_obj.browse(cr, uid, que.id) descriptive_text = "" - separator_string = tools.ustr(qu_no) + "." + tools.ustr(que_rec['question']) - if ((context.has_key('active') and not context.get('active',False)) or not context.has_key('active')) and que_rec['is_require_answer']: + separator_string = tools.ustr(qu_no) + "." + tools.ustr(que_rec.question) + if ((context.has_key('active') and not context.get('active',False)) or not context.has_key('active')) and que_rec.is_require_answer: star = '*' else: star = '' @@ -178,25 +176,25 @@ class survey_question_wiz(osv.osv_memory): xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) etree.SubElement(xml_group, 'separator', {'string': star+to_xml(separator_string), 'colspan': '4'}) - ans_ids = ans_obj.read(cr, uid, que_rec['answer_choice_ids'], []) + ans_ids = que_rec.answer_choice_ids xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) - if que_rec['type'] == 'multiple_choice_only_one_ans': + if que_rec.type == 'multiple_choice_only_one_ans': selection = [] for ans in ans_ids: - selection.append((tools.ustr(ans['id']), ans['answer'])) + selection.append((tools.ustr(ans.id), ans.answer)) xml_group = etree.SubElement(xml_group, 'group', {'col': '2', 'colspan': '2'}) - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_selection"}) - fields[tools.ustr(que) + "_selection"] = {'type':'selection', 'selection' :selection, 'string':"Answer"} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_selection"}) + fields[tools.ustr(que.id) + "_selection"] = {'type':'selection', 'selection' :selection, 'string':"Answer"} - elif que_rec['type'] == 'multiple_choice_multiple_ans': + elif que_rec.type == 'multiple_choice_multiple_ans': xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'}) for ans in ans_ids: - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_" + tools.ustr(ans['id'])}) - fields[tools.ustr(que) + "_" + tools.ustr(ans['id'])] = {'type':'boolean', 'string':ans['answer']} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_" + tools.ustr(ans.id)}) + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id)] = {'type':'boolean', 'string':ans.answer} - elif que_rec['type'] in ['matrix_of_choices_only_one_ans', 'rating_scale']: - if que_rec['comment_column']: + elif que_rec.type in ['matrix_of_choices_only_one_ans', 'rating_scale']: + if que_rec.comment_column: col = "4" colspan = "4" else: @@ -205,135 +203,135 @@ class survey_question_wiz(osv.osv_memory): xml_group = etree.SubElement(xml_group, 'group', {'col': tools.ustr(col), 'colspan': tools.ustr(colspan)}) for row in ans_ids: etree.SubElement(xml_group, 'newline') - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_selection_" + tools.ustr(row['id']),'string':to_xml(tools.ustr(row['answer']))}) + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_selection_" + tools.ustr(row.id),'string':to_xml(tools.ustr(row.answer))}) selection = [('','')] - for col in que_col_head.read(cr, uid, que_rec['column_heading_ids']): - selection.append((str(col['id']), col['title'])) - fields[tools.ustr(que) + "_selection_" + tools.ustr(row['id'])] = {'type':'selection', 'selection' : selection, 'string': "Answer"} - if que_rec['comment_column']: - fields[tools.ustr(que) + "_commentcolumn_"+tools.ustr(row['id']) + "_field"] = {'type':'char', 'size' : 255, 'string':tools.ustr(que_rec['column_name']), 'views':{}} - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_commentcolumn_"+tools.ustr(row['id'])+ "_field"}) + for col in que_rec.column_heading_ids: + selection.append((str(col.id), col.title)) + fields[tools.ustr(que.id) + "_selection_" + tools.ustr(row.id)] = {'type':'selection', 'selection' : selection, 'string': "Answer"} + if que_rec.comment_column: + fields[tools.ustr(que.id) + "_commentcolumn_"+tools.ustr(row.id) + "_field"] = {'type':'char', 'size' : 255, 'string':tools.ustr(que_rec.column_name), 'views':{}} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_commentcolumn_"+tools.ustr(row.id)+ "_field"}) - elif que_rec['type'] == 'matrix_of_choices_only_multi_ans': - xml_group = etree.SubElement(xml_group, 'group', {'col': str(len(que_rec['column_heading_ids']) + 1), 'colspan': '4'}) + elif que_rec.type == 'matrix_of_choices_only_multi_ans': + 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_col_head.read(cr, uid, que_rec['column_heading_ids']): - etree.SubElement(xml_group, 'separator', {'string': tools.ustr(col['title']),'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_col_head.read(cr, uid, que_rec['column_heading_ids']): - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['id']), 'nolabel':"1"}) - fields[tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['id'])] = {'type':'boolean', 'string': col['title']} + etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(row.answer)) +' :-', 'align': '0.0'}) + for col in que_col_head.read(cr, uid, que_rec.column_heading_ids): + 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'}) + 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_col_head.read(cr, uid, que_rec['column_heading_ids']): - etree.SubElement(xml_group, 'separator', {'string': tools.ustr(col['title']),'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_col_head.read(cr, uid, que_rec['column_heading_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 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) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['id']),'nolabel':'1'}) - fields[tools.ustr(que) + "_" + tools.ustr(row['id']) + "_" + tools.ustr(col['id'])] = {'type':'selection', 'string': col['title'], 'selection':selection} + 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': + elif que_rec.type == 'multiple_textboxes': xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'}) type = "char" - if que_rec['is_validation_require']: - if que_rec['validation_type'] in ['must_be_whole_number']: + if que_rec.is_validation_require: + if que_rec.validation_type in ['must_be_whole_number']: type = "integer" - elif que_rec['validation_type'] in ['must_be_decimal_number']: + elif que_rec.validation_type in ['must_be_decimal_number']: type = "float" - elif que_rec['validation_type'] in ['must_be_date']: + elif que_rec.validation_type in ['must_be_date']: type = "date" for ans in ans_ids: - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"}) + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"}) if type == "char" : - fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type':'char', 'size':255, 'string':ans['answer']} + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"] = {'type':'char', 'size':255, 'string':ans.answer} else: - fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type': str(type), 'string':ans['answer']} + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"] = {'type': str(type), 'string':ans.answer} - elif que_rec['type'] == 'numerical_textboxes': + elif que_rec.type == 'numerical_textboxes': xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'}) for ans in ans_ids: - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_numeric"}) - fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_numeric"] = {'type':'integer', 'string':ans['answer']} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_numeric"}) + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_numeric"] = {'type':'integer', 'string':ans.answer} - elif que_rec['type'] == 'date': + elif que_rec.type == 'date': xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'}) for ans in ans_ids: - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que) + "_" + tools.ustr(ans['id'])}) - fields[tools.ustr(que) + "_" + tools.ustr(ans['id'])] = {'type':'date', 'string':ans['answer']} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que.id) + "_" + tools.ustr(ans.id)}) + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id)] = {'type':'date', 'string':ans.answer} - elif que_rec['type'] == 'date_and_time': + elif que_rec.type == 'date_and_time': xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'}) for ans in ans_ids: - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que) + "_" + tools.ustr(ans['id'])}) - fields[tools.ustr(que) + "_" + tools.ustr(ans['id'])] = {'type':'datetime', 'string':ans['answer']} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que.id) + "_" + tools.ustr(ans.id)}) + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id)] = {'type':'datetime', 'string':ans.answer} - elif que_rec['type'] == 'descriptive_text': - for que_test in que_rec['descriptive_text'].split('\n'): + elif que_rec.type == 'descriptive_text': + for que_test in que_rec.descriptive_text.split('\n'): etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"}) - elif que_rec['type'] == 'single_textbox': - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_single", 'nolabel':"1" ,'colspan':"4"}) - fields[tools.ustr(que) + "_single"] = {'type':'char', 'size' : 255, 'string':"single_textbox", 'views':{}} + elif que_rec.type == 'single_textbox': + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_single", 'nolabel':"1" ,'colspan':"4"}) + fields[tools.ustr(que.id) + "_single"] = {'type':'char', 'size' : 255, 'string':"single_textbox", 'views':{}} - elif que_rec['type'] == 'comment': - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_comment", 'nolabel':"1" ,'colspan':"4"}) - fields[tools.ustr(que) + "_comment"] = {'type':'text', 'string':"Comment/Eassy Box", 'views':{}} + elif que_rec.type == 'comment': + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_comment", 'nolabel':"1" ,'colspan':"4"}) + fields[tools.ustr(que.id) + "_comment"] = {'type':'text', 'string':"Comment/Eassy Box", 'views':{}} - elif que_rec['type'] == 'table': - xml_group = etree.SubElement(xml_group, 'group', {'col': str(len(que_rec['column_heading_ids'])), 'colspan': '4'}) - for col in que_col_head.read(cr, uid, que_rec['column_heading_ids']): - etree.SubElement(xml_group, 'separator', {'string': tools.ustr(col['title']),'colspan': '1'}) - for row in range(0,que_rec['no_of_rows']): - for col in que_col_head.read(cr, uid, que_rec['column_heading_ids']): - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_table_" + tools.ustr(col['id']) +"_"+ tools.ustr(row), 'nolabel':"1"}) - fields[tools.ustr(que) + "_table_" + tools.ustr(col['id']) +"_"+ tools.ustr(row)] = {'type':'char','size':255,'views':{}} + elif que_rec.type == 'table': + xml_group = etree.SubElement(xml_group, 'group', {'col': str(len(que_rec.column_heading_ids)), 'colspan': '4'}) + for col in que_rec.column_heading_ids: + etree.SubElement(xml_group, 'separator', {'string': tools.ustr(col.title),'colspan': '1'}) + for row in range(0,que_rec.no_of_rows): + for col in que_rec.column_heading_ids: + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_table_" + tools.ustr(col.id) +"_"+ tools.ustr(row), 'nolabel':"1"}) + fields[tools.ustr(que.id) + "_table_" + tools.ustr(col.id) +"_"+ tools.ustr(row)] = {'type':'char','size':255,'views':{}} - elif que_rec['type'] == 'multiple_textboxes_diff_type': + elif que_rec.type == 'multiple_textboxes_diff_type': xml_group = etree.SubElement(xml_group, 'group', {'col': '4', 'colspan': '4'}) for ans in ans_ids: - if ans['type'] == "email" : - fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type':'char', 'size':255, 'string':ans['answer']} - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'widget':'email','width':"300",'colspan': '1','name': tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"}) + if ans.type == "email" : + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"] = {'type':'char', 'size':255, 'string':ans.answer} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'widget':'email','width':"300",'colspan': '1','name': tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"}) else: - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"}) - if ans['type'] == "char" : - fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type':'char', 'size':255, 'string':ans['answer']} - elif ans['type'] in ['integer','float','date','datetime']: - fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type': str(ans['type']), 'string':ans['answer']} + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'width':"300",'colspan': '1','name': tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"}) + if ans.type == "char" : + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"] = {'type':'char', 'size':255, 'string':ans.answer} + elif ans.type in ['integer','float','date','datetime']: + fields[tools.ustr(que.id) + "_" + tools.ustr(ans.id) + "_multi"] = {'type': str(ans.type), 'string':ans.answer} else: selection = [] - if ans['menu_choice']: - for item in ans['menu_choice'].split('\n'): + if ans.menu_choice: + for item in ans.menu_choice.split('\n'): if item and not item.strip() == '': selection.append((item ,item)) - fields[tools.ustr(que) + "_" + tools.ustr(ans['id']) + "_multi"] = {'type':'selection', 'selection' : selection, 'string':ans['answer']} + 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'] 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) + "_otherfield", 'colspan':"4"}) - fields[tools.ustr(que) + "_otherfield"] = {'type':'boolean', 'string':que_rec['comment_label'], 'views':{}} - if que_rec['comment_field_type'] == 'char': - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_other", 'nolabel':"1" ,'colspan':"4"}) - fields[tools.ustr(que) + "_other"] = {'type': 'char', 'string': '', 'size':255, 'views':{}} - elif que_rec['comment_field_type'] == 'text': - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_other", 'nolabel':"1" ,'colspan':"4"}) - fields[tools.ustr(que) + "_other"] = {'type': 'text', 'string': '', 'views':{}} + 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'] 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':{}} + if que_rec.comment_field_type == 'char': + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_other", 'nolabel':"1" ,'colspan':"4"}) + fields[tools.ustr(que.id) + "_other"] = {'type': 'char', 'string': '', 'size':255, 'views':{}} + elif que_rec.comment_field_type == 'text': + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_other", 'nolabel':"1" ,'colspan':"4"}) + fields[tools.ustr(que.id) + "_other"] = {'type': 'text', 'string': '', 'views':{}} else: - if que_rec['comment_field_type'] == 'char': - etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_rec['comment_label'])),'colspan':"4"}) - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_other", 'nolabel':"1" ,'colspan':"4"}) - fields[tools.ustr(que) + "_other"] = {'type': 'char', 'string': '', 'size':255, 'views':{}} - elif que_rec['comment_field_type'] == 'text': - etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_rec['comment_label'])),'colspan':"4"}) - etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que) + "_other", 'nolabel':"1" ,'colspan':"4"}) - fields[tools.ustr(que) + "_other"] = {'type': 'text', 'string': '', 'views':{}} + if que_rec.comment_field_type == 'char': + etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_rec.comment_label)),'colspan':"4"}) + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_other", 'nolabel':"1" ,'colspan':"4"}) + fields[tools.ustr(que.id) + "_other"] = {'type': 'char', 'string': '', 'size':255, 'views':{}} + elif que_rec.comment_field_type == 'text': + etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_rec.comment_label)),'colspan':"4"}) + etree.SubElement(xml_group, 'field', {'readonly' :str(readonly), 'name': tools.ustr(que.id) + "_other", 'nolabel':"1" ,'colspan':"4"}) + fields[tools.ustr(que.id) + "_other"] = {'type': 'text', 'string': '', 'views':{}} etree.SubElement(xml_form, 'separator', {'colspan': '4'}) xml_group = etree.SubElement(xml_form, 'group', {'col': '6', 'colspan': '4'})