<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017-2020 ForgeFlow, S.L.
     License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->
<odoo>
    <record id="view_stock_request_kanban_tree" model="ir.ui.view">
        <field name="name">stock.request.kanban.tree</field>
        <field name="model">stock.request.kanban</field>
        <field name="arch" type="xml">
            <tree
                decoration-muted="active == 'false'"
                decoration-bf="message_needaction==True"
            >
                <field name="message_needaction" invisible="1" />
                <field name="name" />
                <field name="warehouse_id" groups="stock.group_stock_multi_locations" />
                <field name="allow_virtual_location" invisible="1" />
                <field name="location_id" groups="stock.group_stock_multi_locations" />
                <field
                    name="route_id"
                    options="{'no_create': True}"
                    groups="stock.group_stock_multi_locations"
                />
                <field name="product_id" />
                <field
                    name="product_uom_id"
                    options="{'no_open': True, 'no_create': True}"
                    groups="uom.group_uom"
                />
                <field name="product_uom_qty" />
                <field name="active" invisible="1" />
            </tree>
        </field>
    </record>
    <record model="ir.ui.view" id="stock_request_kanban_search">
        <field name="name">stock.request.kanban.search</field>
        <field name="model">stock.request.kanban</field>
        <field name="arch" type="xml">
            <search string="Stock Requests Kanban">
                <field name="name" string="Stock Requests Kanban" />
                <field name="warehouse_id" groups="stock.group_stock_multi_locations" />
                <field name="location_id" groups="stock.group_stock_multi_locations" />
                <field name="company_id" groups="base.group_multi_company" />
                <field name="product_id" />
                <filter
                    string="Archived"
                    name="inactive"
                    domain="[('active','=',False)]"
                />
                <group expand="0" string="Group By">
                    <filter
                        name="warehouse"
                        string="Warehouse"
                        domain="[]"
                        context="{'group_by':'warehouse_id'}"
                    />
                    <filter
                        name="location"
                        string="Location"
                        domain="[]"
                        context="{'group_by':'location_id'}"
                    />
                </group>
            </search>
        </field>
    </record>
    <record id="view_stock_request_kanban_form" model="ir.ui.view">
        <field name="name">stock.request.kanban.form</field>
        <field name="model">stock.request.kanban</field>
        <field name="arch" type="xml">
            <form string="Stock Requests">
                <field name="company_id" invisible="1" />
                <header />
                <sheet>
                    <div class="oe_button_box" name="button_box" />
                    <div class="oe_title">
                        <label for="name" string="Stock Request Kanban" />
                        <h1>
                            <field name="name" readonly="1" />
                        </h1>
                    </div>
                    <group>
                        <group>
                            <field name="product_id" />
                        </group>
                        <group>
                            <field
                                name="warehouse_id"
                                widget="selection"
                                groups="stock.group_stock_multi_locations"
                            />
                            <field name="allow_virtual_location" invisible="1" />
                            <field
                                name="location_id"
                                groups="stock.group_stock_multi_locations"
                            />
                            <field
                                name="route_id"
                                options="{'no_create': True}"
                                groups="stock.group_stock_multi_locations"
                            />
                            <field name="route_ids" invisible="1" />
                            <field
                                name="procurement_group_id"
                                groups="stock.group_adv_location"
                            />
                            <field
                                name="company_id"
                                groups="base.group_multi_company"
                                options="{'no_create': True}"
                            />
                        </group>
                        <group name="quantities">
                            <label for="product_uom_qty" />
                            <div>
                                <field name="product_uom_qty" class="oe_inline" />
                                <field name="allowed_uom_categ_id" invisible="1" />
                                <field
                                    name="product_uom_id"
                                    class="oe_inline"
                                    options="{'no_open': True, 'no_create': True}"
                                    groups="uom.group_uom"
                                />
                            </div>
                        </group>
                    </group>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers" />
                    <field name="activity_ids" widget="mail_activity" />
                    <field name="message_ids" widget="mail_thread" />
                </div>
            </form>
        </field>
    </record>
    <!-- Partner Kanban View -->
    <record model="ir.ui.view" id="stock_request_kanban_kanban_view">
        <field name="name">stock.request.kanban.kanban</field>
        <field name="model">stock.request.kanban</field>
        <field name="arch" type="xml">
            <kanban class="o_res_partner_kanban">
                <field name="id" />
                <field name="name" />
                <field name="product_id" />
                <field name="display_name" />
                <field name="warehouse_id" />
                <field name="location_id" />
                <field name="product_qty" />
                <templates>
                    <t t-name="kanban-box">
                        <div class="oe_kanban_global_click o_res_partner_kanban">
                            <div class="o_kanban_image">
                                <img
                                    t-att-src="kanban_image('product.product', 'image_128', record.product_id.raw_value)"
                                    alt="Kanban Image"
                                />
                            </div>
                            <div class="oe_kanban_details">
                                <strong class="o_kanban_record_title">
                                    <field name="display_name" />
                                </strong>
                                <div class="o_kanban_tags_section" />
                                <ul>
                                    <li t-if="record.product_id.raw_value">
                                        <field name="product_id" />
                                    </li>
                                    <li
                                        t-if="record.warehouse_id.raw_value"
                                        groups="stock.group_stock_multi_locations"
                                    >
                                        <field name="warehouse_id" />
                                    </li>
                                    <li
                                        t-if="record.location_id.raw_value"
                                        groups="stock.group_stock_multi_locations"
                                    >
                                        <field name="location_id" />
                                    </li>
                                    <li t-if="record.product_qty">
                                        <field name="product_qty" />
                                        <field name="product_uom_id" />
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>
    <record id="stock_request_kanban_action" model="ir.actions.act_window">
        <field name="name">Stock Request Kanbans</field>
        <field name="res_model">stock.request.kanban</field>
        <field name="type">ir.actions.act_window</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="help" type="html">
            <p class="oe_view_nocontent_create">
                Click to add a Stock Request Kanban.
            </p>
        </field>
    </record>
</odoo>
