<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2020 ForgeFlow S.L.
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

    <record id="stock_slot_verification_request_tree_view" model="ir.ui.view">
        <field name="name">stock.slot.verification.request.tree</field>
        <field name="model">stock.slot.verification.request</field>
        <field name="arch" type="xml">
            <tree default_order="id desc">
                <field name="name" />
                <field name="location_id" />
                <field name="product_id" />
                <field name="create_uid" readonly="1" />
                <field name="create_date" readonly="1" />
                <field name="responsible_id" />
                <field name="inventory_id" />
                <field name="state" />
                <field name="company_id" groups="base.group_multi_company" />
            </tree>
        </field>
    </record>

    <record id="stock_slot_verification_request_form_view" model="ir.ui.view">
        <field name="name">stock.slot.verification.request.form</field>
        <field name="model">stock.slot.verification.request</field>
        <field name="arch" type="xml">
            <form>
                <header>
                    <button
                        name="action_create_inventory_adjustment"
                        type="object"
                        states="open"
                        string="Create Inventory Adjustment"
                        class="oe_highlight"
                    />
                    <button
                        name="action_confirm"
                        type="object"
                        states="wait"
                        string="Confirm"
                        class="oe_highlight"
                    />
                    <button
                        name="action_solved"
                        type="object"
                        states="open"
                        string="Mark as Solved"
                    />
                    <button
                        name="action_cancel"
                        type="object"
                        states="open"
                        string="Mark as Cancelled"
                    />
                    <field
                        name="state"
                        widget="statusbar"
                        statusbar_visible="wait,open,done"
                    />
                </header>
                <sheet>
                    <div
                        class="oe_button_box"
                        name="button_box"
                        attrs="{'invisible':
                         [('state', 'not in', ('open'))]}"
                    >
                          <button
                            name="action_view_inventories"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-building-o"
                        >
                              <field
                                name="created_inventory_count"
                                widget="statinfo"
                                help="Inventory Adjustments created from this SVR."
                                modifiers="{'readonly': true}"
                                string="Inv. Adj. Created"
                            />
                          </button>
                          <button
                            name="action_view_move_lines"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-arrows-h"
                        >
                              <field
                                name="involved_move_line_count"
                                widget="statinfo"
                                help="Stock Moves related to the given location and product."
                                modifiers="{'readonly': true}"
                                string="Stock Moves Involved"
                            />
                          </button>
                          <button
                            name="action_view_quants"
                            type="object"
                            class="oe_stat_button"
                            icon="fa-list"
                        >
                              <field
                                name="involved_quant_count"
                                widget="statinfo"
                                help="Stock related to the given location and product."
                                modifiers="{'readonly': true}"
                                string="Stock Reviewed"
                            />
                          </button>
                    </div>
                    <div class="oe_title">
                        <label string="Slot Verification Request" for="name" />
                        <h1>
                            <field name="name" />
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="location_id" />
                            <field name="product_id" />
                            <field name="lot_id" />
                            <field
                                name="company_id"
                                groups="base.group_multi_company"
                            />
                            <field name="create_uid" readonly="1" />
                            <field name="create_date" readonly="1" />
                            <field name="responsible_id" />
                            <field name="inventory_id" />
                            <field name="quant_id" />
                        </group>
                        <group>
                            <field name="notes" />
                        </group>
                    </group>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers" />
                    <field name="message_ids" widget="mail_thread" />
                </div>
            </form>
        </field>
    </record>

    <record id="stock_slot_verification_request_search_view" model="ir.ui.view">
        <field name="name">stock.slot.verification.request.search</field>
        <field name="model">stock.slot.verification.request</field>
        <field name="arch" type="xml">
            <search>
                <field name="name" />
                <field name="location_id" />
                <field name="product_id" />
                <field name="company_id" groups="base.group_multi_company" />
                <field name="responsible_id" />
                <separator />
                <filter
                    name="wait_state"
                    string="Waiting Actions"
                    domain="[('state','=', 'wait')]"
                />
                <filter
                    name="open_state"
                    string="In Progress"
                    domain="[('state','=', 'open')]"
                />
                <filter
                    name="done_state"
                    string="Done"
                    domain="[('state','=', 'done')]"
                />
                <filter
                    name="cancelled_state"
                    string="Cancelled"
                    domain="[('state','=', 'cancelled')]"
                />
                <separator />
                <filter
                    name="assigned_to_user"
                    string="Assigned to me"
                    domain="[('responsible_id','=', uid)]"
                />
            </search>
        </field>
    </record>

    <record id="action_slot_verification_request" model="ir.actions.act_window">
        <field name="name">Stock Slot Verification Request</field>
        <field name="res_model">stock.slot.verification.request</field>
        <field
            name="context"
        >{'search_default_wait_state':1,'search_default_open_state':1}</field>
        <field name="view_mode">tree,form</field>
    </record>
    <menuitem
        id="menu_slot_verification_request"
        name="Slot Verification Request"
        parent="stock.menu_stock_warehouse_mgmt"
        sequence="31"
        action="action_slot_verification_request"
    />

</odoo>
