diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2012-09-10 23:55:16 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2012-09-10 23:55:16 +0200 |
| commit | 05b2b751d1ef255ff59e9af6d509bc7b972665f1 (patch) | |
| tree | e2ac49b4e8f28988e0fad22bebec7c5eabbdae7b /addons | |
| parent | d541c9aa9c04b5d2b8f33a154e46bed261b5beb7 (diff) | |
[IMP] Survey forms
bzr revid: fp@tinyerp.com-20120910215516-8pbknwyk0ifeoku9
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/survey/static/src/css/survey.css | 7 | ||||
| -rw-r--r-- | addons/survey/survey_view.xml | 38 | ||||
| -rw-r--r-- | addons/survey/wizard/survey_answer.py | 26 |
3 files changed, 31 insertions, 40 deletions
diff --git a/addons/survey/static/src/css/survey.css b/addons/survey/static/src/css/survey.css index 7a2174fda8c..34d686c6e77 100644 --- a/addons/survey/static/src/css/survey.css +++ b/addons/survey/static/src/css/survey.css @@ -1,6 +1,11 @@ -.oe_survey_title { +.openerp .oe_survey_title { font-weight: bold; font-size: 19px; margin: 8px 0px 8px 0px; color: #5B5B5B; } + +.openerp .oe_kanban_survey { + width: 200px; + +} diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 5b71d70542b..8f855084069 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -28,6 +28,10 @@ <div class="oe_button_box oe_right"> <button name="test_survey" states="open,draft,close,cancel" string="Test Survey" type="object" icon="gtk-new" context="{'survey_id': active_id}" attrs="{'invisible':[('id','=',0)]}"/> <button name="fill_survey" states="open" string="Answer Survey" type="object" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/> + <button name="action_print_survey" states="open,draft,close,cancel" string="Print Answer" type="object"/> + <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel" + string="Edit Survey" type="action" context="{'active':True,'edit' : True,'survey_id': active_id}"/> + </div> <div class="oe_title"> <label for="title" class="oe_edit_only"/> @@ -49,8 +53,6 @@ </group> <notebook> <page string="Survey Details"> - <field name="note" colspan="4" placeholder="Survey description..."/> - <label for="page_ids"/> <field name="page_ids" colspan="4" mode="tree"> <form string="Survey Page" version="7.0"> <sheet> @@ -58,9 +60,7 @@ <h1> <field name="title"/> </h1> - <group> - <field name="note" placeholder="Description on the survey page..." nolabel="1"/> - </group> + <field name="note" placeholder="Description on the survey page..."/> <newline/> <group> <label for="question_ids"/> @@ -210,6 +210,7 @@ </sheet> </form> </field> + <field name="note" placeholder="Survey description..."/> </page> <page string="Invited User"> <field name="invited_user_ids" readonly="1"/> @@ -293,10 +294,13 @@ <kanban> <field name="title"/> <field name="date_open"/> + <field name="tot_comp_survey"/> + <field name="max_response_limit"/> + <field name="responsible_id"/> <field name="color"/> <templates> <t t-name="kanban-box"> - <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card"> + <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_survey"> <div class="oe_dropdown_toggle oe_dropdown_kanban"> <span class="oe_e">i</span> <ul class="oe_dropdown_menu"> @@ -307,21 +311,13 @@ </div> <div class="oe_kanban_content"> <h3 class="oe_kanban_ellipsis"><t t-esc="record.title.raw_value.toString()"></t></h3> - <div class="oe_survey_responsible"> - <t t-if="record.responsible_id.raw_value">By: <field name="responsible_id"/></t> - </div><br/> - <div class="oe_survey_start_date"> - <t t-if="record.date_open.raw_value"> - Opened at - <t t-esc="record.date_open.raw_value.getDate()"/> - <t t-esc="record.date_open.raw_value.toString('MMM')"/>, - <t t-esc="record.date_open.raw_value.getFullYear()"/> - </t> - </div><br/> - <div class="oe_survey_rate"> - Rate: - <a name="fill_survey" type="object">Fill</a> - </div> + <div> + Answers: <field name="tot_comp_survey"/> + <t t-if="record.max_response_limit.raw_value > 0"> / <field name="max_response_limit"/></t> + </div> + <br/> + <a name="fill_survey" type="object">Answer Survey</a> + <img t-att-src="kanban_image('res.users', 'image_small', record.responsible_id.raw_value)" t-att-title="record.responsible_id.value" width="24" height="24" class="oe_kanban_avatar oe_right"/> </div> </div> </t> diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py index 7d16b88a4ef..2b774a22feb 100644 --- a/addons/survey/wizard/survey_answer.py +++ b/addons/survey/wizard/survey_answer.py @@ -146,14 +146,8 @@ class survey_question_wiz(osv.osv_memory): pre_button = True if flag: pag_rec = page_obj.browse(cr, uid, p_id, context=context) - xml_form = etree.Element('form', {'string': tools.ustr(sur_rec.title)}) - xml_header = etree.SubElement(xml_form, 'header', {'col': '6', 'colspan': '4' ,'class': 'oe_survey_title_height'}) - xml_header_title = etree.SubElement(xml_header, 'group', {'col': '6', 'colspan': '6'}) - - etree.SubElement(xml_header_title, 'label', {'string': tools.ustr(pag_rec.title) ,'colspan': '2' ,'class' : 'oe_survey_title'}) - xml_header_group = etree.SubElement(xml_header_title, 'group', {'col': '4', 'colspan': '1'}) + xml_form = etree.Element('form', {'string': tools.ustr(pag_rec.title or sur_rec.title)}) if context.has_key('active') and context.get('active',False) and context.has_key('edit'): - etree.SubElement(xml_form, 'separator', {'string' : '','colspan': '4'}) context.update({'page_id' : tools.ustr(p_id),'page_number' : sur_name_rec.page_no , 'transfer' : sur_name_read.transfer}) xml_group3 = etree.SubElement(xml_form, 'group', {'col': '4', 'colspan': '4'}) etree.SubElement(xml_group3, 'button', {'string' :'Add Page','icon': "gtk-new", 'type' :'object','name':"action_new_page", 'context' : tools.ustr(context)}) @@ -161,7 +155,9 @@ class survey_question_wiz(osv.osv_memory): etree.SubElement(xml_group3, 'button', {'string' :'Delete Page','icon': "gtk-delete", 'type' :'object','name':"action_delete_page", 'context' : tools.ustr(context)}) etree.SubElement(xml_group3, 'button', {'string' :'Add Question','icon': "gtk-new", 'type' :'object','name':"action_new_question", 'context' : tools.ustr(context)}) - xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) + # FP Note + xml_group = xml_form + if context.has_key('response_id') and context.get('response_id', False) \ and int(context.get('response_id',0)[0]) > 0: # TODO: l10n, cleanup this code to make it readable. Or template? @@ -179,9 +175,8 @@ class survey_question_wiz(osv.osv_memory): etree.SubElement(xml_form, 'field', {'invisible':'1','name': "wizardid_" + str(wiz_id),'default':str(lambda *a: 0),'modifiers':'{"invisible":true}'}) if pag_rec.note: - xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) for que_test in pag_rec.note.split('\n'): - etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"}) + etree.SubElement(xml_form, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"}) que_ids = pag_rec.question_ids qu_no = 0 @@ -194,19 +189,16 @@ class survey_question_wiz(osv.osv_memory): star = '*' else: star = '' - xml_group = etree.SubElement(xml_form, 'group', {'col': '2', 'colspan': '4'}) - if context.has_key('active') and context.get('active',False) and \ context.has_key('edit'): - xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '2'}) - etree.SubElement(xml_group, 'separator', {'string': star+to_xml(separator_string), 'colspan': '3'}) + etree.SubElement(xml_form, 'separator', {'string': star+to_xml(separator_string)}) + xml_group1 = etree.SubElement(xml_form, 'group', {'col': '2', 'colspan': '2'}) context.update({'question_id' : tools.ustr(que.id),'page_number': sur_name_rec.page_no , 'transfer' : sur_name_read.transfer, 'page_id' : p_id}) etree.SubElement(xml_group1, 'button', {'string':'','icon': "gtk-edit", 'type' :'object', 'name':"action_edit_question", 'context' : tools.ustr(context)}) etree.SubElement(xml_group1, 'button', {'string':'','icon': "gtk-delete", 'type' :'object','name':"action_delete_question", 'context' : tools.ustr(context)}) else: - xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) - etree.SubElement(xml_group, 'separator', {'string': star+to_xml(separator_string), 'colspan': '4'}) + etree.SubElement(xml_form, 'separator', {'string': star+to_xml(separator_string)}) ans_ids = que_rec.answer_choice_ids xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'}) @@ -366,8 +358,6 @@ class survey_question_wiz(osv.osv_memory): 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_footer = etree.SubElement(xml_form, 'footer', {'col': '8', 'colspan': '1', 'width':"100%"}) if pre_button: |
