<odoo>
    <record id="tier_review_report_tree" model="ir.ui.view">
        <field name="name">tier.review.report.tree</field>
        <field name="model">tier.review</field>
        <field name="priority" eval="100" />
        <field name="arch" type="xml">
            <tree
                decoration-danger="status=='rejected'"
                decoration-success="status=='approved'"
                create="0"
                edit="0"
                delete="0"
                editable="top"
            >
                <field name="resource_type" />
                <field name="resource_name" />
                <button
                    name="action_open_resource_ref"
                    type="object"
                    icon="fa-folder-open-o"
                    string=" Open Resource"
                    class="float-left"
                />
                <field name="requested_by" />
                <field name="todo_by" />
                <field name="status" />
                <field name="review_type" optional="hide" />
                <field name="name" optional="hide" />
                <field name="done_by" optional="hide" />
                <field name="reviewed_date" optional="hide" />
                <field name="comment" optional="hide" />
                <field name="next_review" string="" />
            </tree>
        </field>
    </record>

    <record id="tier_review_report_form" model="ir.ui.view">
        <field name="name">tier.review.report.tree</field>
        <field name="model">tier.review</field>
        <field name="arch" type="xml">
            <form create="0" edit="0" delete="0">
                <header>
                    <button
                        name="action_open_resource_ref"
                        type="object"
                        string="Open Resource"
                        class="oe_highlight"
                        icon="fa-folder-open-o"
                    />
                    <field name="status" widget="statusbar" />
                </header>
                <sheet>
                    <div class="oe_title">
                        <h1>
                            <field name="next_review" readonly="1" />
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="resource_type" />
                            <field name="resource_name" />
                            <field name="requested_by" />
                            <field name="review_type" />
                            <field name="name" />
                        </group>
                        <group>
                            <field name="todo_by" />
                            <field name="done_by" />
                            <field name="reviewed_date" />
                            <field name="comment" />
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>

    <record id="tier_review_report_search" model="ir.ui.view">
        <field name="name">tier.review.report.search</field>
        <field name="model">tier.review</field>
        <field name="arch" type="xml">
            <search>
                <field name="resource_ref" string="Resource Ref" />
                <field name="requested_by" string="Requested By" />
                <field name="reviewer_ids" string="To Review" />
                <field name="done_by" string="Done By" />
                <filter
                    name="pending"
                    string="To Review"
                    domain="[('status', '=', 'pending')]"
                />
                <filter
                    name="rejected"
                    string="Rejected"
                    domain="[('status', '=', 'rejected')]"
                />
                <filter
                    name="approved"
                    string="Approved"
                    domain="[('status', '=', 'approved')]"
                />
            </search>
        </field>
    </record>

    <record id="tier_review_my_action" model="ir.actions.act_window">
        <field name="name">My Reviews</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">tier.review</field>
        <field name="view_mode">tree,form</field>
        <field name="domain">[("reviewer_ids", "in", uid)]</field>
        <field name="context">{"search_default_pending": True}</field>
        <field name="view_id" ref="tier_review_report_tree" />
        <field name="search_view_id" ref="tier_review_report_search" />
    </record>

    <record id="tier_review_all_action" model="ir.actions.act_window">
        <field name="name">All Reviews</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">tier.review</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{}</field>
        <field name="view_id" ref="tier_review_report_tree" />
        <field name="search_view_id" ref="tier_review_report_search" />
        <field
            name="groups_id"
            eval="[(4, ref('base_tier_validation_report.group_see_all_reviews'))]"
        />
    </record>

    <menuitem
        id="menu_tier_validation_report"
        name="Reviews"
        parent="base.menu_board_root"
        sequence="3"
    />
    <menuitem
        id="menu_tier_review_report_my"
        parent="menu_tier_validation_report"
        action="tier_review_my_action"
        sequence="10"
    />
    <menuitem
        id="menu_tier_review_report_all"
        parent="menu_tier_validation_report"
        action="tier_review_all_action"
        sequence="20"
        groups="base_tier_validation_report.group_see_all_reviews"
    />

</odoo>
