<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

            <menuitem icon="STOCK_PREFERENCES" id="base.menu_tools" name="Tools" sequence="28"/>
            <menuitem name="Surveys" id="menu_surveys" parent="base.menu_tools"
                        groups="base.group_tool_manager,base.group_tool_user,base.group_system,base.group_user" sequence="2"/>
            <menuitem name="Define Surveys" id="menu_define_survey"
                 groups="base.group_tool_manager,base.group_tool_user,base.group_system"
                 parent="menu_surveys" />
            <menuitem id="menu_answer_surveys" name="Answer Surveys" parent="menu_surveys" groups="base.group_tool_manager,base.group_tool_user,base.group_system,base.group_user"/>
            <menuitem name="Reporting" parent="base.menu_tools"
                id="base.menu_lunch_reporting" sequence="6"/>
            <menuitem name="Surveys" id="menu_reporting" parent="base.menu_lunch_reporting" sequence="2"/>
        <!--
            Survey
        -->

        <record model="ir.ui.view" id="survey_form">
            <field name="name">survey_form</field>
            <field name="model">survey</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey">
                    <field name="title" select="1"/>
                    <group col="6" colspan="6">
                        <field name="responsible_id"/>
                        <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}"/>
                    </group>
                    <notebook colspan="4">
                        <page string="Survey">
                            <field name="page_ids" colspan="4" nolabel="1" mode="form,tree" context="{'line_order': page_ids}">
                                <form string="Survey Page">
                                    <field name="title" select="1"/>
                                    <field name="sequence" groups="base.group_extended"/>
                                    <field name="note" colspan="4" nolabel="1"/>
                                    <field name="question_ids" height="200" width="200" colspan="4" nolabel="1" context="{'line_order': question_ids}">
                                        <form string="Survey Question" >
                                            <group col="6" colspan="6" height="600" width="200">
                                            <field name="question" colspan="4" select="1"/>
                                            <field name="sequence"/>
                                            <field name="tot_resp"/>
                                            <field name="type" on_change="on_change_type(type)"/>
                                            <field name="in_visible_rating_weight" invisible="1"/>
                                            <field name="in_visible_menu_choice" invisible="1"/>
                                            <field name="in_visible_answer_type" invisible="1"/>
                                            <notebook colspan="4">
                                                <page string="Options">
                                                    <group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
                                                      <separator string="Answer" colspan="4"/>
                                                       <group colspan="4" attrs="{'invisible':[('type','=','table')]}">
                                                           <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids}" default_get="{'in_visible_answer_type': in_visible_answer_type}"/>
                                                       </group>
                                                       <group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
                                                           <field name="column_heading_ids" colspan="4" nolabel="1" default_get="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
                                                            <group colspan="4" attrs="{'invisible':[('type','!=','table')]}">
                                                               <field name="no_of_rows"/>
                                                            </group>
                                                       </group>
                                                    </group>
                                                    <newline/>
                                                    <group  attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'), ('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
                                                        <separator string="Comment Field" colspan="4"/>
                                                        <group colspan="4">
                                                            <field name="is_comment_require"/>
                                                        </group>
                                                        <group attrs="{'invisible':[('is_comment_require','=',False)]}">
                                                            <group col="4" colspan="4">
                                                                <field name="comment_field_type" colspan="1"/>
                                                                <group colspan="2" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                                                    <field colspan="2" name="comment_label" />
                                                                </group>
                                                            </group>
                                                            <group col="6" colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                                                <field name="comment_valid_type" colspan="2"/>
                                                                <group colspan="2" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'), ('comment_valid_type','!=','must_be_whole_number')]}">
                                                                    <field name="comment_minimum_no" string="Between"/>
                                                                    <field name="comment_maximum_no" string="and"/>
                                                                </group>
                                                                <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_decimal_number')]}">
                                                                    <field name="comment_minimum_float" string="Between"/>
                                                                    <field name="comment_maximum_float" string="and"/>
                                                                </group>
                                                                <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_date')]}">
                                                                    <field name="comment_minimum_date" string="Between"/>
                                                                    <field name="comment_maximum_date" string="and"/>
                                                                </group>
                                                                <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'),('comment_valid_type','!=','must_be_decimal_number'),('comment_valid_type','!=','must_be_whole_number'),('comment_valid_type','!=','must_be_date'),('comment_valid_type','!=','must_be_email_address')]}">
                                                                    <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                                                    <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
                                                                </group>
                                                            </group>
                                                        </group>
                                                    </group>
                                                    <newline/>
                                                    <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_one_ans'),('type','!=','rating_scale')]}">
                                                        <field name="comment_column"/>
                                                        <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">
                                                            <field name="column_name" colspan="2"/>
                                                        </group>
                                                    </group>
                                                    <newline/>
                                                    <group attrs="{'invisible':[('type','!=','single_textbox'), ('type','!=','multiple_textboxes')]}">
                                                        <separator string="Validation" colspan="4"/>
                                                        <group colspan="4">
                                                            <field name="is_validation_require"/>
                                                        </group>
                                                        <group col="6" colspan="4" attrs="{'invisible':[('is_validation_require','=',False)]}">
                                                            <field name="validation_type" colspan="2"/>
                                                            <group colspan="2" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'), ('validation_type','!=','must_be_whole_number')]}">
                                                                <field name="validation_minimum_no" string="Between"/>
                                                                <field name="validation_maximum_no" string="and"/>
                                                            </group>
                                                            <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_decimal_number')]}">
                                                                <field name="validation_minimum_float" string="Between"/>
                                                                <field name="validation_maximum_float" string="and"/>
                                                            </group>
                                                            <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_date')]}">
                                                                <field name="validation_minimum_date" string="Between"/>
                                                                <field name="validation_maximum_date" string="and"/>
                                                            </group>
                                                        </group>
                                                        <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'),('validation_type','!=','must_be_decimal_number'),('validation_type','!=','must_be_whole_number'),('validation_type','!=','must_be_date'),('validation_type','!=','must_be_email_address')]}">
                                                            <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                                            <field name="validation_valid_err_msg" nolabel="1" colspan="4"/>
                                                        </group>
                                                    </group>
                                                    <newline/>
                                                    <group attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','single_textbox'),('type','!=','comment'),('type','!=','multiple_textboxes_diff_type')]}">
                                                        <separator string="Required Answer" colspan="4"/>
                                                        <newline/>
                                                        <field name="is_require_answer"/>
                                                        <group col="6" colspan="4" attrs="{'invisible':[('is_require_answer','=',False)]}">
                                                            <group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','multiple_textboxes_diff_type')]}">
                                                                <field name="required_type"/>
                                                                <group colspan="2" attrs="{'invisible':[('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly')]}">
                                                                    <field name="req_ans" />
                                                                </group>
                                                                <group colspan="4" attrs="{'invisible':[('required_type','!=','a range')]}">
                                                                    <field name="minimum_req_ans"/>
                                                                    <field name="maximum_req_ans"/>
                                                                </group>
                                                            </group>
                                                            <group colspan="4" attrs="{'invisible':[('required_type','!=','all'),('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly'),('required_type','!=','a range'),('is_require_answer','!=',True)]}">
                                                                <label string="When the question is not answered, display this error message:"/>
                                                                <field name="req_error_msg" colspan="4" nolabel="1"/>
                                                            </group>
                                                            <group colspan="4" attrs="{'invisible':[('type','!=','numerical_textboxes')]}">
                                                                <group colspan="2" >
                                                                    <field name="numeric_required_sum"/>
                                                                </group>
                                                                <newline/>
                                                                <label string="When the choices do not add up correctly, display this error message"/>
                                                                <field name="numeric_required_sum_err_msg" colspan="4" nolabel="1"/>
                                                            </group>
                                                            <group colspan="4" attrs="{'invisible':[('type','!=','rating_scale')]}">
                                                                <field name="rating_allow_one_column_require"/>
                                                            </group>
                                                        </group>
                                                    </group>
                                                    <newline/>
                                                    <group attrs="{'invisible':[('type','!=','descriptive_text')]}">
                                                        <separator string="Descriptive Text" colspan="4"/>
                                                        <field name="descriptive_text" colspan="4" nolabel="1"/>
                                                    </group>
                                                </page>
                                            </notebook>
                                            </group>
                                        </form>
                                        <tree string="Survey Question">
                                            <field name="sequence" string="Seq"/>
                                            <field name="question" colspan="4" select="1"/>
                                            <field name="answer_choice_ids"/>
                                        </tree>
                                    </field>
                                </form>
                            </field>
                            <group col="9" colspan="4">
                                <field name="state"/>
                                <button name="survey_draft"
                                    string="Set to draft" states="cancel,close" type="object"
                                    icon="gtk-new"/>
                                <button name="survey_open" string="Open"
                                    states="draft" type="object" icon="gtk-go-forward"/>
                                <button name="survey_close"
                                    string="Close" states="open" type="object" icon="gtk-close"/>
                                <button name="survey_cancel"
                                    string="Cancel" states="open" type="object" icon="gtk-cancel"/>
                            </group>
                        </page>
                        <page string="Other">
                            <group colspan="6" col='4'>
                                <field name="max_response_limit"
                                    attrs="{'readonly':[('state','in',('open','close'))]}"/>
                                <field name="response_user"
                                    attrs="{'readonly':[('state','in',('open','close'))]}"/>
                                <field name="type"/>
                                <field name="send_response"/>
                            </group>
                            <separator colspan="4" string="Survey Details"/>
                            <field name="note" colspan="4" nolabel="1"/>
                        </page>
                        <page string="History">
                            <field name="date_open" select="1"/>
                            <field name="date_close"/>
                            <field name="tot_start_survey" select="1"/>
                            <field name="tot_comp_survey" select="1"/>
                            <field name="history" colspan="4" nolabel="1">
                                <tree string="History">
                                    <field name="date"/>
                                    <field name="user_id"/>
                                </tree>
                                <form string="History">
                                    <field name="date"/>
                                    <field name="user_id"/>
                                </form>
                               </field>
                           </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record model ="ir.ui.view" id= "survey_tree">
            <field name="name">survey_tree</field>
            <field name="model">survey</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree colors="gray:state in ('close')" string="Survey">
                    <field name="title" select="1"/>
                    <field name="type" select="1"/>
                    <field name="responsible_id"/>
                    <field name="date_open" select="1" string="Open Date"/>
                    <field name="tot_start_survey" string="Started"/>
                    <field name="tot_comp_survey" string="Completed"/>
                    <field name="state" select="1"/>
                    <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="action_print_survey" states="open,draft,close,cancel"
                                    string="Print Answer" type="object" icon="gtk-print"/>
                </tree>
            </field>
        </record>

       <record id="survey_search" model="ir.ui.view">
            <field name="name">survey_search</field>
            <field name="model">survey</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Survey">
                   <group col='10' colspan='4'>
                        <filter icon="terp-document-new" string="Current" domain="[('state','in', ('draft', 'open'))]"/>
                        <separator orientation="vertical"/>
                        <field name="title" select="1"/>
                        <field name="type" select="1" widget="selection"/>
                        <field name="responsible_id" select="1" default="1">
                            <filter string="MY" icon="terp-personal" domain="[('responsible_id','=',uid)]" help="My Survey(s)"/>
                        </field>
                   </group>
                   <newline/>
                   <group expand="0" string="Group By..." colspan="4" col="20">
	                   <filter string="Responsible" icon="terp-personal" domain="[]"  context="{'group_by':'responsible_id'}"/>
                        <separator orientation="vertical"/>
	                   <filter string="Type" icon="terp-stock_symbol-selection" domain="[]"  context="{'group_by':'type'}"/>
	                   <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]"  context="{'group_by':'state'}"/>
                   </group>
               </search>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_survey_form1">
            <field name="name">Surveys</field>
            <field name="res_model">survey</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="survey_tree"></field>
            <field name="search_view_id" ref="survey_search"/>
        </record>


        <menuitem name="Surveys" id="menu_survey_form"
            action="action_survey_form1" parent="menu_define_survey"
            groups="base.group_tool_manager,base.group_tool_user,base.group_system"/>

        <!--
            Survey Pages
        -->

        <record model="ir.ui.view" id="survey_page_form">
            <field name="name">survey_page_form</field>
            <field name="model">survey.page</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Page">
                    <field name="title" colspan="4" select="1"/>
                    <field name="survey_id" select="1"/>
                    <field name="sequence"/>
                    <separator string="Description" colspan="4"/>
                    <field name="note" colspan="4" nolabel="1"/>
                    <field name="question_ids" colspan="4" nolabel="1" context="{'line_order': question_ids}">
                    <form string="Survey Question">
                        <field name="question" colspan="4" select="1"/>
                        <field name="sequence"/>
                        <field name="tot_resp"/>
                        <field name="type" on_change="on_change_type(type)"/>
                        <field name="in_visible_rating_weight" invisible="1"/>
                        <field name="in_visible_menu_choice" invisible="1"/>
                        <field name="in_visible_answer_type" invisible="1"/>
                        <notebook colspan="4">
                            <page string="Options">
                                <group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
                                  <separator string="Answer" colspan="4"/>
                                   <group colspan="4" attrs="{'invisible':[('type','=','table')]}">
                                       <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids}" default_get="{'in_visible_answer_type': in_visible_answer_type}"/>
                                   </group>
                                   <group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
                                       <field name="column_heading_ids" colspan="4" nolabel="1" default_get="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
                                        <group colspan="4" attrs="{'invisible':[('type','!=','table')]}">
                                           <field name="no_of_rows"/>
                                        </group>
                                   </group>
                                </group>
                                <newline/>
                                <group  attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'), ('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
                                    <separator string="Comment Field" colspan="4"/>
                                    <group colspan="4">
                                        <field name="is_comment_require"/>
                                    </group>
                                    <group attrs="{'invisible':[('is_comment_require','=',False)]}">
                                        <group col="4" colspan="4">
                                            <field name="comment_field_type" colspan="1"/>
                                            <group colspan="2" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                                <field colspan="2" name="comment_label" />
                                            </group>
                                        </group>
                                        <group col="6" colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                            <field name="comment_valid_type" colspan="2"/>
                                            <group colspan="2" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'), ('comment_valid_type','!=','must_be_whole_number')]}">
                                                <field name="comment_minimum_no" string="Between"/>
                                                <field name="comment_maximum_no" string="and"/>
                                            </group>
                                            <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_decimal_number')]}">
                                                <field name="comment_minimum_float" string="Between"/>
                                                <field name="comment_maximum_float" string="and"/>
                                            </group>
                                            <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_date')]}">
                                                <field name="comment_minimum_date" string="Between"/>
                                                <field name="comment_maximum_date" string="and"/>
                                            </group>
                                            <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'),('comment_valid_type','!=','must_be_decimal_number'),('comment_valid_type','!=','must_be_whole_number'),('comment_valid_type','!=','must_be_date'),('comment_valid_type','!=','must_be_email_address')]}">
                                                <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                                <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
                                            </group>
                                        </group>
                                    </group>
                                </group>
                                <newline/>
                                <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_one_ans'),('type','!=','rating_scale')]}">
                                    <field name="comment_column"/>
                                    <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">
                                        <field name="column_name" colspan="2"/>
                                    </group>
                                </group>
                                <newline/>
                                <group attrs="{'invisible':[('type','!=','single_textbox'), ('type','!=','multiple_textboxes')]}">
                                    <separator string="Validation" colspan="4"/>
                                    <group colspan="4">
                                        <field name="is_validation_require"/>
                                    </group>
                                    <group col="6" colspan="4" attrs="{'invisible':[('is_validation_require','=',False)]}">
                                        <field name="validation_type" colspan="2"/>
                                        <group colspan="2" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'), ('validation_type','!=','must_be_whole_number')]}">
                                            <field name="validation_minimum_no" string="Between"/>
                                            <field name="validation_maximum_no" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_decimal_number')]}">
                                            <field name="validation_minimum_float" string="Between"/>
                                            <field name="validation_maximum_float" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_date')]}">
                                            <field name="validation_minimum_date" string="Between"/>
                                            <field name="validation_maximum_date" string="and"/>
                                        </group>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'),('validation_type','!=','must_be_decimal_number'),('validation_type','!=','must_be_whole_number'),('validation_type','!=','must_be_date'),('validation_type','!=','must_be_email_address')]}">
                                        <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                        <field name="validation_valid_err_msg" nolabel="1" colspan="4"/>
                                    </group>
                                </group>
                                <newline/>
                                <group attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','single_textbox'),('type','!=','comment'),('type','!=','multiple_textboxes_diff_type')]}">
                                    <separator string="Required Answer" colspan="4"/>
                                    <newline/>
                                    <field name="is_require_answer"/>
                                    <group col="6" colspan="4" attrs="{'invisible':[('is_require_answer','=',False)]}">
                                        <group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','multiple_textboxes_diff_type')]}">
                                            <field name="required_type"/>
                                            <group colspan="2" attrs="{'invisible':[('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly')]}">
                                                <field name="req_ans" />
                                            </group>
                                            <group colspan="4" attrs="{'invisible':[('required_type','!=','a range')]}">
                                                <field name="minimum_req_ans"/>
                                                <field name="maximum_req_ans"/>
                                            </group>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('required_type','!=','all'),('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly'),('required_type','!=','a range'),('is_require_answer','!=',True)]}">
                                            <label string="When the question is not answered, display this error message:"/>
                                            <field name="req_error_msg" colspan="4" nolabel="1"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('type','!=','numerical_textboxes')]}">
                                            <group colspan="2" >
                                                <field name="numeric_required_sum"/>
                                            </group>
                                            <newline/>
                                            <label string="When the choices do not add up correctly, display this error message"/>
                                            <field name="numeric_required_sum_err_msg" colspan="4" nolabel="1"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('type','!=','rating_scale')]}">
                                            <field name="rating_allow_one_column_require"/>
                                        </group>
                                    </group>
                                </group>
                                <newline/>
                                <group attrs="{'invisible':[('type','!=','descriptive_text')]}">
                                    <separator string="Descriptive Text" colspan="4"/>
                                    <field name="descriptive_text" colspan="4" nolabel="1"/>
                                </group>
                            </page>
                        </notebook>

                    </form>
                    <tree string="Survey Question">
                        <field name="sequence" string="Seq"/>
                        <field name="question" colspan="4" select="1"/>
                        <field name="answer_choice_ids"/>
                    </tree>
                    </field>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id="survey_page_tree">
            <field name="name">survey_page_tree</field>
            <field name="model">survey.page</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Survey Page">
                    <field name="sequence" string="Seq"/>
                    <field name="title"/>
                    <field name="survey_id"/>
                    <field name="question_ids" string="#Questions"/>
                </tree>
            </field>
        </record>

        <record id="view_survey_page_filter" model="ir.ui.view">
            <field name="name">survey.page.list.select</field>
            <field name="model">survey.page</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Survey Page">
                    <field name="title"/>
                    <field name="survey_id"/>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="4" col="20">
                        <filter string="Survey" icon="terp-stock_align_left_24" domain="[]"  context="{'group_by':'survey_id'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_survey_page_form">
            <field name="name">Survey Pages</field>
            <field name="res_model">survey.page</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="survey_page_tree"></field>
        </record>

        <menuitem name="Survey Pages" id="menu_survey_page_form1"
            action="action_survey_page_form" parent='menu_define_survey'
            groups="base.group_tool_manager,base.group_tool_user,base.group_system"/>

        <record model="ir.ui.view" id="survey_page_wizard_test1">
            <field name="name">survey_page_wizard_test</field>
            <field name="model">survey.page</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Pages">
                    <field name="title" colspan="4" select="1"/>
                    <field name="sequence"/>
                    <separator string="Description" colspan="4"/>
                    <field name="note" colspan="4" nolabel="1"/>
                      <group colspan="4">
                          <label string="" colspan="3"/>
                        <button name="survey_save"  string="Ok" type="object" icon="gtk-go-forward"/>
                    </group>
                </form>
            </field>
        </record>

        <!--
            Survey Question
        -->

        <record model="ir.ui.view" id="survey_question_form">
            <field name="name">survey_question_form</field>
            <field name="model">survey.question</field>
            <field name="type">form</field>
            <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)"/>
                    <field name="in_visible_rating_weight" invisible="1"/>
                    <field name="in_visible_menu_choice" invisible="1"/>
                    <field name="in_visible_answer_type" invisible="1"/>
                    <notebook colspan="4">
                        <page string="Options">
                            <group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
                              <separator string="Answer" colspan="4"/>
                               <group colspan="4" attrs="{'invisible':[('type','=','table')]}">
                                   <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids}" default_get="{'in_visible_answer_type': in_visible_answer_type}"/>
                               </group>
                               <group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
                                   <field name="column_heading_ids" colspan="4" nolabel="1" default_get="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
                                    <group colspan="4" attrs="{'invisible':[('type','!=','table')]}">
                                       <field name="no_of_rows"/>
                                    </group>
                               </group>
                            </group>
                            <newline/>
                            <group  attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'), ('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
                                <separator string="Comment Field" colspan="4"/>
                                <group colspan="4">
                                    <field name="is_comment_require"/>
                                </group>
                                <group attrs="{'invisible':[('is_comment_require','=',False)]}">
                                    <group col="4" colspan="4">
                                        <field name="comment_field_type" colspan="1"/>
                                        <group colspan="2" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                            <field colspan="2" name="comment_label" />
                                        </group>
                                    </group>
                                    <group col="6" colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                        <field name="comment_valid_type" colspan="2"/>
                                        <group colspan="2" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'), ('comment_valid_type','!=','must_be_whole_number')]}">
                                            <field name="comment_minimum_no" string="Between"/>
                                            <field name="comment_maximum_no" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_decimal_number')]}">
                                            <field name="comment_minimum_float" string="Between"/>
                                            <field name="comment_maximum_float" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_date')]}">
                                            <field name="comment_minimum_date" string="Between"/>
                                            <field name="comment_maximum_date" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'),('comment_valid_type','!=','must_be_decimal_number'),('comment_valid_type','!=','must_be_whole_number'),('comment_valid_type','!=','must_be_date'),('comment_valid_type','!=','must_be_email_address')]}">
                                            <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                            <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
                                        </group>
                                    </group>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_one_ans'),('type','!=','rating_scale')]}">
                                <field name="comment_column"/>
                                <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">
                                    <field name="column_name" colspan="2"/>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','single_textbox'), ('type','!=','multiple_textboxes')]}">
                                <separator string="Validation" colspan="4"/>
                                <group colspan="4">
                                    <field name="is_validation_require"/>
                                </group>
                                <group col="6" colspan="4" attrs="{'invisible':[('is_validation_require','=',False)]}">
                                    <field name="validation_type" colspan="2"/>
                                    <group colspan="2" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'), ('validation_type','!=','must_be_whole_number')]}">
                                        <field name="validation_minimum_no" string="Between"/>
                                        <field name="validation_maximum_no" string="and"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_decimal_number')]}">
                                        <field name="validation_minimum_float" string="Between"/>
                                        <field name="validation_maximum_float" string="and"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_date')]}">
                                        <field name="validation_minimum_date" string="Between"/>
                                        <field name="validation_maximum_date" string="and"/>
                                    </group>
                                </group>
                                <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'),('validation_type','!=','must_be_decimal_number'),('validation_type','!=','must_be_whole_number'),('validation_type','!=','must_be_date'),('validation_type','!=','must_be_email_address')]}">
                                    <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                    <field name="validation_valid_err_msg" nolabel="1" colspan="4"/>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','single_textbox'),('type','!=','comment'),('type','!=','multiple_textboxes_diff_type')]}">
                                <separator string="Required Answer" colspan="4"/>
                                <newline/>
                                <field name="is_require_answer"/>
                                <group col="6" colspan="4" attrs="{'invisible':[('is_require_answer','=',False)]}">
                                    <group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','multiple_textboxes_diff_type')]}">
                                        <field name="required_type"/>
                                        <group colspan="2" attrs="{'invisible':[('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly')]}">
                                            <field name="req_ans" />
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('required_type','!=','a range')]}">
                                            <field name="minimum_req_ans"/>
                                            <field name="maximum_req_ans"/>
                                        </group>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('required_type','!=','all'),('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly'),('required_type','!=','a range'),('is_require_answer','!=',True)]}">
                                        <label string="When the question is not answered, display this error message:"/>
                                        <field name="req_error_msg" colspan="4" nolabel="1"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('type','!=','numerical_textboxes')]}">
                                        <group colspan="2" >
                                            <field name="numeric_required_sum"/>
                                        </group>
                                        <newline/>
                                        <label string="When the choices do not add up correctly, display this error message"/>
                                        <field name="numeric_required_sum_err_msg" colspan="4" nolabel="1"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('type','!=','rating_scale')]}">
                                        <field name="rating_allow_one_column_require"/>
                                    </group>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','descriptive_text')]}">
                                <separator string="Descriptive Text" colspan="4"/>
                                <field name="descriptive_text" colspan="4" nolabel="1"/>
                            </group>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="survey_question_tree">
            <field name="name">survey_question_tree</field>
            <field name="model">survey.question</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Survey Question">
                    <field name="sequence" string="Seq"/>
                    <field name="question"/>
                    <field name="page_id"/>
                    <field name="survey"/>
                    <field name="type"/>
                </tree>
            </field>
        </record>

       <record id="survey_question_search" model="ir.ui.view">
            <field name="name">survey_question_search</field>
            <field name="model">survey.question</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Question">
                    <field name="question"/>
                    <field name="page_id"/>
                    <field name="survey" widget="selection"/>
                    <field name="type"/>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="4" col="20">
                        <filter string="Page" icon="terp-stock_align_left_24" domain="[]"  context="{'group_by':'page_id'}"/>
                    </group>
               </search>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_survey_question_form">
            <field name="name">Survey Questions</field>
            <field name="res_model">survey.question</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="survey_question_tree"></field>
             <field name="search_view_id" ref="survey_question_search"/>
        </record>

        <record model="ir.ui.view" id="survey_question_wizard_test">
            <field name="name">survey_question_wizard_test</field>
            <field name="model">survey.question</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Question">
                    <field name="question" colspan="4"/>
                    <field name="sequence"/>
                    <field name="tot_resp"/>
                    <field name="type" on_change="on_change_type(type)"/>
                    <field name="in_visible_rating_weight" invisible="1"/>
                    <field name="in_visible_menu_choice" invisible="1"/>
                    <field name="in_visible_answer_type" invisible="1"/>
                    <notebook colspan="4">
                        <page string="Options">
                            <group attrs="{'invisible':[('type','!=','multiple_textboxes_diff_type'),('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','table')]}">
                              <separator string="Answer" colspan="4"/>
                               <group colspan="4" attrs="{'invisible':[('type','=','table')]}">
                                   <field name="answer_choice_ids" nolabel="1" colspan="4" context="{'line_order': answer_choice_ids}" default_get="{'in_visible_answer_type': in_visible_answer_type}"/>
                               </group>
                               <group colspan="4" attrs="{'invisible':[('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','table')]}">
                                   <field name="column_heading_ids" colspan="4" nolabel="1" default_get="{'in_visible_rating_weight':in_visible_rating_weight,'in_visible_menu_choice':in_visible_menu_choice}"/>
                                    <group colspan="4" attrs="{'invisible':[('type','!=','table')]}">
                                       <field name="no_of_rows"/>
                                    </group>
                               </group>
                            </group>
                            <newline/>
                            <group  attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'), ('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale')]}">
                                <separator string="Comment Field" colspan="4"/>
                                <group colspan="4">
                                    <field name="is_comment_require"/>
                                </group>
                                <group attrs="{'invisible':[('is_comment_require','=',False)]}">
                                    <group col="4" colspan="4">
                                        <field name="comment_field_type" colspan="1"/>
                                        <group colspan="2" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                            <field colspan="2" name="comment_label" />
                                        </group>
                                    </group>
                                    <group col="6" colspan="4" attrs="{'invisible':[('comment_field_type','!=','char'),('comment_field_type','!=','text')]}">
                                        <field name="comment_valid_type" colspan="2"/>
                                        <group colspan="2" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'), ('comment_valid_type','!=','must_be_whole_number')]}">
                                            <field name="comment_minimum_no" string="Between"/>
                                            <field name="comment_maximum_no" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_decimal_number')]}">
                                            <field name="comment_minimum_float" string="Between"/>
                                            <field name="comment_maximum_float" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_date')]}">
                                            <field name="comment_minimum_date" string="Between"/>
                                            <field name="comment_maximum_date" string="and"/>
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('comment_valid_type','!=','must_be_specific_length'),('comment_valid_type','!=','must_be_decimal_number'),('comment_valid_type','!=','must_be_whole_number'),('comment_valid_type','!=','must_be_date'),('comment_valid_type','!=','must_be_email_address')]}">
                                            <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                            <field name="comment_valid_err_msg" nolabel="1" colspan="4"/>
                                        </group>
                                    </group>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','matrix_of_choices_only_one_ans'),('type','!=','rating_scale')]}">
                                <field name="comment_column"/>
                                <group colspan="2" attrs="{'invisible':[('comment_column','!=',True)]}">
                                    <field name="column_name" colspan="2"/>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','single_textbox'), ('type','!=','multiple_textboxes')]}">
                                <separator string="Validation" colspan="4"/>
                                <group colspan="4">
                                    <field name="is_validation_require"/>
                                </group>
                                <group col="6" colspan="4" attrs="{'invisible':[('is_validation_require','=',False)]}">
                                    <field name="validation_type" colspan="2"/>
                                    <group colspan="2" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'), ('validation_type','!=','must_be_whole_number')]}">
                                        <field name="validation_minimum_no" string="Between"/>
                                        <field name="validation_maximum_no" string="and"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_decimal_number')]}">
                                        <field name="validation_minimum_float" string="Between"/>
                                        <field name="validation_maximum_float" string="and"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_date')]}">
                                        <field name="validation_minimum_date" string="Between"/>
                                        <field name="validation_maximum_date" string="and"/>
                                    </group>
                                </group>
                                <group colspan="4" attrs="{'invisible':[('validation_type','!=','must_be_specific_length'),('validation_type','!=','must_be_decimal_number'),('validation_type','!=','must_be_whole_number'),('validation_type','!=','must_be_date'),('validation_type','!=','must_be_email_address')]}">
                                    <label string="When the comment is an invalid format, display this error message" colspan="4"/>
                                    <field name="validation_valid_err_msg" nolabel="1" colspan="4"/>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','multiple_choice_only_one_ans'), ('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','single_textbox'),('type','!=','comment'),('type','!=','multiple_textboxes_diff_type')]}">
                                <separator string="Required Answer" colspan="4"/>
                                <newline/>
                                <field name="is_require_answer"/>
                                <group col="6" colspan="4" attrs="{'invisible':[('is_require_answer','=',False)]}">
                                    <group colspan="4" attrs="{'invisible':[('type','!=','multiple_choice_multiple_ans'),('type','!=','matrix_of_choices_only_one_ans'),('type','!=','matrix_of_choices_only_multi_ans'),('type','!=','matrix_of_drop_down_menus'),('type','!=','rating_scale'),('type','!=','multiple_textboxes'),('type','!=','numerical_textboxes'),('type','!=','date'),('type','!=','date_and_time'),('type','!=','multiple_textboxes_diff_type')]}">
                                        <field name="required_type"/>
                                        <group colspan="2" attrs="{'invisible':[('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly')]}">
                                            <field name="req_ans" />
                                        </group>
                                        <group colspan="4" attrs="{'invisible':[('required_type','!=','a range')]}">
                                            <field name="minimum_req_ans"/>
                                            <field name="maximum_req_ans"/>
                                        </group>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('required_type','!=','all'),('required_type','!=','at least'),('required_type','!=','at most'),('required_type','!=','exactly'),('required_type','!=','a range'),('is_require_answer','!=',True)]}">
                                        <label string="When the question is not answered, display this error message:"/>
                                        <field name="req_error_msg" colspan="4" nolabel="1"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('type','!=','numerical_textboxes')]}">
                                        <group colspan="2" >
                                            <field name="numeric_required_sum"/>
                                        </group>
                                        <newline/>
                                        <label string="When the choices do not add up correctly, display this error message"/>
                                        <field name="numeric_required_sum_err_msg" colspan="4" nolabel="1"/>
                                    </group>
                                    <group colspan="4" attrs="{'invisible':[('type','!=','rating_scale')]}">
                                        <field name="rating_allow_one_column_require"/>
                                    </group>
                                </group>
                            </group>
                            <newline/>
                            <group attrs="{'invisible':[('type','!=','descriptive_text')]}">
                                <separator string="Descriptive Text" colspan="4"/>
                                <field name="descriptive_text" colspan="4" nolabel="1"/>
                            </group>
                        </page>
                    </notebook>
                      <group colspan="4">
                          <label string="" colspan="3"/>
                        <button name="survey_save"  string="Ok" type="object" icon="gtk-go-forward"/>
                    </group>
                </form>
            </field>
        </record>

        <!--
            Survey Answer
        -->

        <record model ="ir.ui.view" id="survey_answer_form">
            <field name="name">survey_answer_form</field>
            <field name="model">survey.answer</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Answer">
                    <field name="answer" colspan="4" select="1"/>
                    <field name="sequence"/>
                    <field name="in_visible_answer_type" invisible="1"/>
                       <group colspan="4" attrs="{'invisible':[('in_visible_answer_type','=',True)]}">
                        <field name="type" colspan="2"/>
                        <group colspan="4" attrs="{'invisible':[('type','!=','selection')]}">
                            <separator string="Menu Choices (each choice on separate by lines)" colspan="4"/>
                            <field name="menu_choice" colspan="4" nolabel="1"/>
                        </group>
                    </group>
                </form>
            </field>
        </record>


        <record model="ir.ui.view" id= "survey_answer_tree">
            <field name="name">survey_answer_tree</field>
            <field name="model">survey.answer</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree editable="bottom" string="Survey Answer">
                    <field name="sequence" string="Seq"/>
                    <field name="answer" select="1"/>
                    <field name="type"/>
                </tree>
            </field>
        </record>

        <!--
            Survey Response Line
        -->

        <record model ="ir.ui.view" id= "survey_response_line_form">
            <field name="name">survey_response_line_form</field>
            <field name="model">survey.response.line</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Answer">
                    <field name="question_id"/>
                    <field name="date_create" select="1"/>
                    <notebook colspan="4">
                        <page string="Answer">
                            <field name="response_answer_ids" colspan="4" nolabel="1"/>
                            <group col="5" colspan="4">
                                <field name="state"/>
                            </group>
                        </page>
                        <page string="Single Textboxes">
                            <field name="single_text" colspan="4"/>
                        </page>
                        <page string="Comment">
                            <separator string="Description" colspan="4"/>
                            <field name="comment" nolabel="1" colspan="4"/>
                        </page>
                        <page string="Table Answer">
                            <field name="response_table_ids" colspan="4" nolabel="1">
                            <form string="Table">
                                <field name="column_id"/>
                                <field name="name"/>
                                <field name="value"/>
                            </form>
                            <tree string="Table">
                                <field name="column_id"/>
                                <field name="name"/>
                                <field name="value"/>
                            </tree>
                            </field>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="survey_response_line_tree">
            <field name="name">survey_response_line_tree</field>
            <field name="model">survey.response.line</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Survey Answer Line">
                    <field name="page_id"/>
                    <field name="question_id"/>
                    <field name="date_create" select="1"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <!--
            Survey Response
        -->

        <record model="ir.ui.view" id="survey_response_form">
            <field name="name">survey_response_form</field>
            <field name="model">survey.response</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Answer">
                    <field name="survey_id" select="1"/>
                    <field name="date_create" select="1"/>
                    <field name="user_id" select="1"/>
                    <field name="response_type" select="1"/>
                    <field name="question_ids" nolabel="1" colspan="4" />
                    <field name="state" select="1"/>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="survey_response_tree">
            <field name="name">survey_response_tree</field>
            <field name="model">survey.response</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Survey Answer">
                    <field name="survey_id" select="1"/>
                    <field name="date_create" select="1"/>
                    <field name="user_id" select="1"/>
                    <field name="response_type" select="1"/>
                    <field name="state" select="1"/>
                </tree>
            </field>
        </record>

        <!--
            Survey Response Answer
        -->

        <record model="ir.ui.view" id="survey_response_answer_form">
            <field name="name">survey_response_answer_form</field>
            <field name="model">survey.response.answer</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Answer">
                    <group colspan="4">
                        <field name="answer_id"/>
                        <field name="answer" />
                    </group>
                    <field name="value_choice"/>
                    <label string="(Use Only Question Type is matrix_of_drop_down_menus)" align="0.0"/>
                    <group colspan="4" col="4">
                        <field name="comment_field"/>
                        <field name="column_id"/>
                    </group>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="survey_response_answer_tree">
            <field name="name">survey_response_answer_tree</field>
            <field name="model">survey.response.answer</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree editable="top" string="Survey Answer">
                    <field name="answer_id"/>
                    <field name="answer" />
                    <field name="value_choice" />
                    <field name="column_id"/>
                    <field name="comment_field"/>
                </tree>
            </field>
        </record>

        <!--
            Survey Question Column Heading
    -->

        <record model="ir.ui.view" id="survey_question_column_heading_form">
            <field name="name">survey_question_column_heading_form</field>
            <field name="model">survey.question.column.heading</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Column Heading">
                    <field name="title"/>
                    <field name="in_visible_rating_weight" invisible="1"/>
                    <field name="in_visible_menu_choice" invisible="1"/>
                    <group colspan="4" attrs="{'invisible':[('in_visible_rating_weight','!=',False)]}">
                        <field name="rating_weight"/>
                        <label align="0.0" string="Use if question type is rating_scale" />
                    </group>
                    <group colspan="4" attrs="{'invisible':[('in_visible_menu_choice','!=',False)]}">
                        <separator string="Menu Choices (each choice on separate lines)" colspan="4"/>
                        <field name="menu_choice" nolabel="1" colspan="4"/>
                    </group>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="survey_question_column_heading_tree">
            <field name="name">survey_question_column_heading_tree</field>
            <field name="model">survey.question.column.heading</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree editable="bottom" string="Column Heading">
                    <field name="title"/>
                </tree>
            </field>
        </record>

        <!--
            Survey Request
        -->

        <record model="ir.ui.view" id="survey_request_form">
            <field name="name">survey_request_form</field>
            <field name="model">survey.request</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Request">
                    <field name="date_deadline"/>
                    <field name="survey_id"/>
                    <field name="user_id" on_change="on_change_user(user_id)"/>
                     <field name="response" readonly="1"/>
                    <group colspan="4" col="6">
                     <field name="state"/>
                         <button name="survey_req_draft" string="Set to Draft" states="cancel,done" type="object" icon="gtk-new"/>
                        <button name="survey_req_waiting_answer" string="Watting Answer" states="draft" type="object" icon="gtk-new"/>
                        <button name="survey_req_done" string="Done" states="waiting_answer" type="object" icon="gtk-ok"/>
                        <button name="survey_req_cancel" string="Cancelled" states="waiting_answer" type="object" icon="gtk-cancel"/>
                    </group>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="survey_request_tree">
            <field name="name">survey_request_tree</field>
            <field name="model">survey.request</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Evaluation Plan Phase">
                    <field name="date_deadline"/>
                    <field name="user_id"/>
                    <field name="survey_id"/>
                    <field name="response" />
                    <field name="state" />
                </tree>
            </field>
        </record>

       <record id="survey_request_search" model="ir.ui.view">
            <field name="name">survey_request_search</field>
            <field name="model">survey.request</field>
            <field name="type">search</field>
            <field name="arch" type="xml">
                <search string="Search Survey">
                   <group col='10' colspan='4'>
                        <filter icon="terp-gtk-media-pause" string="Waiting Answer" domain="[('state','=','waiting_answer')]"/>
                        <filter icon="terp-emblem-important" string="Late" domain="[('date_deadline','&lt;',current_date)]"/>
                        <separator orientation="vertical"/>
                        <field name="survey_id" widget="selection" select="1"/>
                        <field name="email" select="1"/>
                        <field name="user_id" select="1" default="1">
                        <filter string="MY" icon="terp-personal" domain="[('user_id','=',uid)]"/>
                        </field>
                    </group>
                    <newline/>
                    <group expand="0" string="Group By..." colspan="4" col="20">
	                    <filter string="User" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
                        <separator orientation="vertical"/>
	                    <filter string="Survey" icon="terp-stock_align_left_24" domain="[]"  context="{'group_by':'survey_id'}"/>
                        <separator orientation="vertical"/>
	                    <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]"  context="{'group_by':'state'}"/>
                    </group>
               </search>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_survey_request_tree">
            <field name="name">Survey Request</field>
            <field name="res_model">survey.request</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('user_id','=',uid)]</field>
            <field name="view_id" ref="survey_request_tree"></field>
            <field name="search_view_id" ref="survey_request_search"/>
        </record>

        <menuitem name="Survey Requests" id="menu_survey_type_form1"
            action="action_survey_request_tree" parent='menu_answer_surveys'
            groups="base.group_tool_manager,base.group_tool_user,base.group_system"/>

        <!--
            Survey Type
        -->

        <record model="ir.ui.view" id="survey_type_form">
            <field name="name">survey_type_form</field>
            <field name="model">survey.type</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Survey Type">
                    <field name="name" select="1"/>
                    <field name="code" select="1"/>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="survey_type_tree">
            <field name="name">survey_type_tree</field>
            <field name="model">survey.type</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="Survey Type">
                    <field name="name" select="1"/>
                    <field name="code" select="1"/>
                </tree>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_survey_type_form">
            <field name="name">Survey Type</field>
            <field name="res_model">survey.type</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="survey_type_tree"></field>
        </record>

        <act_window domain="[('survey_id', '=', active_id)]"
            id="act_survey_pages"
            name="Pages"
            res_model="survey.page"
            src_model="survey"/>

        <act_window domain="[('survey', '=', active_id)]"
            id="act_survey_question"
            name="Questions"
            res_model="survey.question"
            src_model="survey"/>


        <act_window domain="[('page_id', '=', active_id)]"
            id="act_survey_page_question"
            name="Questions"
            res_model="survey.question"
            src_model="survey.page"/>

        <act_window domain="[('question_id', '=', active_id)]"
            id="act_survey_answer"
            name="Answers"
            res_model="survey.answer"
            src_model="survey.question"/>

        <menuitem name="Answer a Survey" id="menu_run_survey_form" sequence="2"
            action="action_view_survey_name" parent="menu_answer_surveys"
            groups="base.group_tool_manager,base.group_tool_user,base.group_system,base.group_user" icon="STOCK_INDEX"/>

    </data>
</openerp>
