<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="act_view_sub_br_all" model="ir.actions.act_window">
            <field name="name">Business Requirement</field>
            <field name="res_model">business.requirement</field>
            <field name="view_mode">tree,form</field>
            <field name="domain">[('parent_id', '=', active_id)]</field>
            <field name="context">{
                'search_default_parent_id': [active_id],
                'default_parent_id': active_id,
            }</field>
        </record>

        <record id="view_business_requirement_form" model="ir.ui.view">
            <field name="name">business.requirement.form</field>
            <field name="model">business.requirement</field>
            <field name="type">form</field>
            <field name="priority">20</field>
            <field name="arch" type="xml">
                <form string="Business Requirement">
                    <header>
                        <field name="state" widget="statusbar" clickable="True"
                               statusbar_visible="draft,confirmed,approved,stakeholder_approval,in_progress,done,cancel,drop"/>
                    </header>
                    <sheet>
                        <div class="oe_left">
                            <field name="kanban_state" class="oe_inline" widget="kanban_state_selection"/>
                        </div>
                        <div class="oe_right oe_button_box" name="buttons" groups="base.group_user">
                             <button class="oe_inline oe_stat_button" type="action" name="%(act_view_sub_br_all)d" icon="fa-tasks">
                                <field name="sub_br_count" string="Sub Bus. Req." widget="statinfo"/>
                            </button>
                        </div>
                        <h1>
                            <field name="name" class="oe_inline" readonly="1"/>-
                            <field name="description"/>
                        </h1>
                        <group col="4">
                            <field name="responsible_id" required="1"/>
                            <field name="project_id" domain="[('state', '=', 'open')]"/>
                            <field name="partner_id"/>
                            <field name="ref"/>
                            <field name="origin"/>
                            <field name="category_ids" widget="many2many_tags"/>

                            <field name="to_be_reviewed"/>
                            <field name="reviewer_ids" widget="many2many_tags"/>
                            <field name="priority" groups="base.group_user" widget="priority"/>
                        </group>
                        
                        <notebook>
                            <page string="Business Requirement">
                                <group string="Customer Story">
                                     <field name="business_requirement" nolabel="1"/>
                                </group>
                                <group string="Scenario">
                                    <field name="scenario" nolabel="1"/>
                                </group>
                                <group string="Gap">
                                     <field name="gap" nolabel="1"/>
                                </group>
                                <group string="Test Case">
                                     <field name="test_case" nolabel="1"/>
                                </group>
                            </page>
                            <page string="Logs">
                                <group col="12">
                                    <field name="level" invisible="1"/>
                                </group>
                                <group col="12">
                                    <field name="create_uid" readonly="1"/>
                                    <field name="create_date" string="Creation Date" readonly="1"/>
                                </group>
                                <group col="12">
                                    <field name="confirmed_id"/>
                                    <field name="confirmation_date"/>
                                </group>
                                <group col="12">
                                    <field name="approved_id"/>
                                    <field name="approval_date"/>
                                </group>
                            </page>
                            <page string="Other">
                                <group col="12">
                                    <field name="parent_id"/>
                                    <field name="requested_id"/>
                                </group>
                                <group col="12">
                                    <field name="change_request"/>
                                    <field name="company_id" groups="base.group_multi_company"/>
                                </group>
                            </page>
                        </notebook>
                    </sheet>
                    <footer>
                        <div class="oe_chatter">
                            <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
                            <field name="message_ids" widget="mail_thread"/>
                        </div>
                    </footer>
                </form>
            </field>
        </record>

        <record id="view_business_requirement_tree" model="ir.ui.view">
            <field name="name">business.requirement.tree</field>
            <field name="model">business.requirement</field>
            <field name="arch" type="xml">
                <tree string="Business Requirement">
                    <field name="responsible_id"/>
                    <field name="name"/>
                    <field name="description"/>
                    <field name="ref"/>
                    <field name="project_id"/>
                    <field name="category_ids"/>
                    <field name="change_request"/>
                    <field name="priority"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="view_business_requirement_search" model="ir.ui.view">
            <field name="name">business.requirement.search</field>
            <field name="model">business.requirement</field>
            <field name="arch" type="xml">
                <search string="Business Requirement">
                    <field name="name" string="Name" filter_domain="['|',('name','ilike',self),('description','ilike',self)]"/>
                    <field name="project_id" string="Project"/>
                    <field name="partner_id" string="Customer"/>
                    <field name="responsible_id" string="Responsible"/>
                    <field name="origin" string="Source"/>
                    <filter string="To be Reviewed" name="to_be_reviewed" domain="[('to_be_reviewed','!=', False)]"/>
                    <group expand="0" string="Group By">
                        <filter string="Project" context="{'group_by':'project_id'}"/>
                        <filter string="Customer" context="{'group_by':'partner_id'}"/>
                        <filter string="State" context="{'group_by':'state'}"/>
                        <filter string="Priority" context="{'group_by':'priority'}"/>
                        <filter string="Responsible" context="{'group_by':'responsible_id'}"/>
                    </group>
                </search>
            </field>
        </record>

        <record id="view_business_requirement_category_form" model="ir.ui.view">
            <field name="name">business.requirement.category.form</field>
            <field name="model">business.requirement.category</field>
            <field name="type">form</field>
            <field name="priority">20</field>
            <field name="arch" type="xml">
                <form string="Business Requirement">
                    <sheet>
                        <group>
                             <field name="name"/>
                             <field name="parent_id"/>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <record id="view_business_requirement_category_tree" model="ir.ui.view">
            <field name="name">business.requirement.category.form</field>
            <field name="model">business.requirement.category</field>
            <field name="type">tree</field>
            <field name="priority">20</field>
            <field name="arch" type="xml">
                <tree string="Business Requirement">
                     <field name="name"/>
                     <field name="parent_id"/>
                </tree>
            </field>
        </record>

        <record id="act_view_project_br_all" model="ir.actions.act_window">
            <field name="name">Business Requirement</field>
            <field name="res_model">business.requirement</field>
            <field name="view_mode">tree,form</field>
            <field name="search_view_id" ref="business_requirement.view_business_requirement_search"/>
            <field name="context">{
                'search_default_project_id': [active_id],
                'default_project_id': active_id,
                'active_test': False,
            }</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">
                    Click to start a new Business Requirement.
                </p>
                <p>
                    <ul>
                        <li>
                            A Business requirement (BR) is the expression of a business need
                            by a customer or internal project user.
                        </li>
                        <li>
                            A BR contains multiple different parts to explain the stakeholder
                            need and how to meet his/her requirements:
                        </li>
                        <li>
                            Customer Story: this is the requirement as expressed by the
                            customer.
                        </li>
                        <li>
                            Customer Story: this is the requirement as expressed by the
                            customer.
                        </li>
                        <li>
                            Scenario: How/where the current solution can provide a suitable
                            scenario to answer the customer story.
                        </li>
                        <li>
                            Gap: For the uncovered part of the scenario, elaborate the
                            gap/need for specific developments/setup.
                        </li>
                        <li>
                            Test case: A set of conditions under which a tester will
                            determine whether the application, software system or one of
                            its features is working as it was originally established
                            for it to do.
                        </li>
                        <li>
                            Deliverables to be provided to the customer/user
                        </li>
                        <li>
                            Resources necessary to achieve the deliverables.
                        </li>
                        <li>
                            Additional information (approval, cost control etc).
                        </li>
                    </ul>
                </p>
            </field>
        </record>

        <record model="ir.ui.view" id="view_business_requirement_graph">
            <field name="name">Business requirement</field>
            <field name="model">business.requirement</field>
            <field name="arch" type="xml">
                <graph string="Business Requirement" type="pivot" stacked="True">
                    <field name="partner_id" type="row"/>
                    <field name="project_id" type="col"/>
                </graph>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_business_requirement_tree">
            <field name="name">Business Requirement</field>
            <field name="res_model">business.requirement</field>
            <field name="view_mode">tree,form,graph</field>
            <field name="view_type">form</field>
            <field name="context">{}</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">
                    Click to start a new Business Requirement.
                </p>
                <p>
                    <ul>
                        <li>
                            A Business requirement (BR) is the expression of a business need
                            by a customer or internal project user.
                        </li>
                        <li>
                            A BR contains multiple different parts to explain the stakeholder
                            need and how to meet his/her requirements:
                        </li>
                        <li>
                            Customer Story: this is the requirement as expressed by the
                            customer.
                        </li>
                        <li>
                            Customer Story: this is the requirement as expressed by the
                            customer.
                        </li>
                        <li>
                            Scenario: How/where the current solution can provide a suitable
                            scenario to answer the customer story.
                        </li>
                        <li>
                            Gap: For the uncovered part of the scenario, elaborate the
                            gap/need for specific developments/setup.
                        </li>
                        <li>
                            Test case: A set of conditions under which a tester will
                            determine whether the application, software system or one of
                            its features is working as it was originally established
                            for it to do.
                        </li>
                        <li>
                            Deliverables to be provided to the customer/user
                        </li>
                        <li>
                            Resources necessary to achieve the deliverables.
                        </li>
                        <li>
                            Additional information (approval, cost control etc).
                        </li>
                    </ul>
                </p>
            </field>
        </record>

        <record model="ir.actions.act_window" id="action_business_requirement_category_tree">
            <field name="name">Categories</field>
            <field name="res_model">business.requirement.category</field>
            <field name="view_mode">tree,form,graph</field>
            <field name="view_type">form</field>
            <field name="context">{}</field>
        </record>

        <!-- Top menu item -->
        <menuitem id="menu_business_root"  name="Business Requirement"  groups="business_requirement.group_business_requirement_user" sequence="30"/>

        <menuitem id="menu_business_requirement" name="Business Requirement" groups="business_requirement.group_business_requirement_user" parent="menu_business_root" sequence="8"/>

        <menuitem id="menu_business_configuration" name="Configuration" groups="business_requirement.group_business_requirement_user" parent="menu_business_root" sequence="8"/>

        <menuitem id="menu_business_requirement1" groups="business_requirement.group_business_requirement_user" action="action_business_requirement_tree" 
            parent="menu_business_requirement" sequence="10"/>

        <menuitem id="menu_business_requirement_category" groups="business_requirement.group_business_requirement_user" action="action_business_requirement_category_tree" 
            parent="menu_business_configuration" sequence="10"/>

        <menuitem action="product.product_template_action"
            id="menu_product_template_action"
            parent="menu_business_configuration" sequence="11" />

    </data>
</openerp>
