[IMP] Tour cleanup
[odoo/odoo.git] / addons / survey / survey_view.xml
index b8c6f97..f6973a5 100644 (file)
@@ -1,13 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
     <data>
+        <!-- Top menu item -->
+        <menuitem name="Tools" id="base.menu_tools" sequence="120" groups="base.group_tool_user"/>
 
         <menuitem name="Surveys" id="menu_surveys" parent="base.menu_tools" sequence="2" groups="base.group_tool_user,base.group_tool_manager,base.group_survey_user"/>
         
         <menuitem name="Reporting" parent="base.menu_tools"
             id="base.menu_lunch_reporting" sequence="6"/>
         <menuitem name="Reporting" id="menu_reporting" parent="menu_surveys" sequence="60"/>
-        <menuitem id="base.next_id_10" name="Survey" parent="base.menu_reporting" sequence="1" />
+        <menuitem id="base.next_id_10" name="Survey" parent="base.menu_reporting" sequence="1" groups="base.group_survey_user"/>
 
         <!--
             Survey
                 <header>
                     <button name="survey_open" string="Open" states="cancel,close" type="object"/>
                     <button name="survey_close" string="Close" states="open" type="object" class="oe_highlight"/>
-                    <button name="survey_cancel" string="Cancel" states="open" type="object"/>
+                    <button name="survey_cancel" string="Cancel Survey" states="open" type="object"/>
                     <field name="state" widget="statusbar" statusbar_visible="open,close"/>
                 </header>
                 <sheet>
                     <div class="oe_button_box oe_right">
-                        <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel" string="Test Survey" type="action" icon="gtk-new" context="{'active':True,'survey_id': active_id}" attrs="{'invisible':[('id','=',0)]}"/>
-                        <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel" string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
+                        <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="edit_survey" states="open,draft,close,cancel"
+                            string="Edit Survey" type="object" context="{'active':True,'edit' : True,'survey_id': active_id}"/>
+
                     </div>
                     <div class="oe_title">
                         <label for="title" class="oe_edit_only"/>
                         <h1>
-                            <field name="title"/>
+                            <field name="title" attrs="{'readonly':[('state','=','close')]}"/>
                         </h1>
                     </div>
                     <group>
                         <group>
                             <field name="id" invisible="1"/>
-                            <field name="responsible_id" class="oe_inline"/>
-                            <field name="send_response"/>
-                            <field name="type"/>
+                            <field name="responsible_id" class="oe_inline" attrs="{'readonly':[('state','=','close')]}" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_survey_user', 'base.group_tool_manager']}"/>
+                            <field name="type" attrs="{'readonly':[('state','=','close')]}" class="oe_inline"/>
+                            <field name="send_response" attrs="{'readonly':[('state','=','close')]}"/>
                         </group>
                         <group>
-                            <field name="max_response_limit" attrs="{'readonly':[('state','in',('open','close'))]}"/>
-                            <field name="response_user" attrs="{'readonly':[('state','in',('open','close'))]}"/>
+                            <field name="max_response_limit" attrs="{'readonly':[('state','=','close')]}"/>
+                            <field name="response_user" attrs="{'readonly':[('state','=','close')]}"/>
                         </group>
                      </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">
+                            <field name="page_ids" colspan="4" mode="tree" attrs="{'readonly':[('state','=','close')]}">
                                 <form string="Survey Page" version="7.0">
                                     <sheet>
                                     <label for="title" class="oe_edit_only"/>
                                     <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"/>
                                     </sheet>
                                     </form>
                                 </field>
+                            <field name="note" placeholder="Survey description..." attrs="{'readonly':[('state','=','close')]}"/>
                         </page>
                         <page string="Invited User">
                             <field name="invited_user_ids" readonly="1"/>
                     <field name="tot_start_survey" string="Started"/>
                     <field name="tot_comp_survey" string="Completed"/>
                     <field name="state"/>
-                    <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
-                        string="Test Survey" type="action" icon="gtk-new"
-                        context="{'active':True,'survey_id': active_id}"/>
-                    <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
-                        string="Answer Survey" type="action" icon="gtk-execute" context="{'survey_id': active_id}" attrs="{'invisible':[('state','!=','open')]}"/>
-                    <button name="%(action_view_survey_question_message)d" states="open,draft,close,cancel"
-                        string="Edit Survey" type="action" icon="gtk-edit" context="{'active':True,'edit' : True,'survey_id': active_id}"/>
+                    <button name="test_survey" states="open,draft,close,cancel"
+                        string="Test Survey" type="object" icon="gtk-new"
+                        context="{'survey_id': active_id}"/>
+                    <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" icon="gtk-print"/>
                 </tree>
                 <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">
-                                        <li><a type="edit">Edit...</a></li>
-                                        <li><a type="delete">Delete</a></li>
+                                        <t t-if="widget.view.is_action_enabled('edit')"><li><a type="edit">Edit...</a></li></t>
+                                        <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t>
                                         <li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
                                     </ul>
                                 </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>
             <field name="arch" type="xml">
                 <form string="Survey Question">
                     <field name="question" colspan="4"/>
+                    <field name="page_id"/>
                     <field name="sequence"/>
                     <field name="tot_resp"/>
                     <field name="type" on_change="on_change_type(type)"/>
                 <form string="Survey Answer">
                     <field name="survey_id"/>
                     <field name="date_create"/>
-                    <field name="user_id"/>
+                    <field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_survey_user']}"/>
                     <field name="response_type"/>
                     <field name="question_ids" nolabel="1" colspan="4" />
                     <field name="state"/>
                     <button name="survey_req_draft" string="Set to Draft" states="cancel,done" type="object"/>
                     <button name="survey_req_waiting_answer" string="Waiting Answer" states="draft" type="object" class="oe_highlight"/>
                     <button name="survey_req_done" string="Done" states="waiting_answer" type="object" class="oe_highlight"/>
-                    <button name="survey_req_cancel" string="Cancel" states="waiting_answer" type="object"/>
+                    <button name="survey_req_cancel" string="Cancel Request" states="waiting_answer" type="object"/>
                     <field name="state" widget="statusbar" statusbar_visible="draft,waiting_answer"/>
                 </header>
                 <sheet string="Survey Request">
                     <group class="oe_header">
                     <field name="date_deadline"/>
                     <field name="survey_id"/>
-                    <field name="user_id" on_change="on_change_user(user_id)"/>
-                     <field name="response" readonly="1"/>
+                    <field name="user_id" on_change="on_change_user(user_id)" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_survey_user']}"/>
+                    <field name="email"/>
+                    <field name="response" readonly="1"/>
                     </group>
                     </sheet>
                 </form>
                 <tree string="Evaluation Plan Phase" colors="red:date_deadline&lt;current_date">
                     <field name="date_deadline"/>
                     <field name="user_id"/>
+                    <field name="email"/>
                     <field name="survey_id"/>
                     <field name="response" />
                     <field name="state" />