<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 ForgeFlow S.L. (https://www.forgeflow.com)
     License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
 -->
<odoo>
    <record id="view_ddmrp_warning_item_tree" model="ir.ui.view">
        <field name="name">ddmrp.warning.item.tree</field>
        <field name="model">ddmrp.warning.item</field>
        <field name="arch" type="xml">
            <tree
                decoration-info="severity == '1_low'"
                decoration-warning="severity == '2_mid'"
                decoration-danger="severity == '3_high'"
            >
                <field name="name" />
                <field name="product_id" />
                <field name="severity" />
                <field name="location_id" groups="stock.group_stock_multi_locations" />
                <field name="company_id" groups="base.group_multi_company" />
            </tree>
        </field>
    </record>
    <record id="view_ddmrp_warning_item_form" model="ir.ui.view">
        <field name="name">ddmrp.warning.item.form</field>
        <field name="model">ddmrp.warning.item</field>
        <field name="arch" type="xml">
            <form>
                <sheet>
                    <group>
                        <group>
                            <field name="warning_definition_id" />
                            <field name="buffer_id" />
                            <field name="severity" />
                        </group>
                        <group>
                            <field name="product_id" />
                            <field
                                name="location_id"
                                groups="stock.group_stock_multi_locations"
                            />
                            <field
                                name="company_id"
                                groups="base.group_multi_company"
                            />
                        </group>
                    </group>
                </sheet>
            </form>
        </field>
    </record>
    <record id="view_ddmrp_warning_item_search" model="ir.ui.view">
        <field name="name">ddmrp.warning.item.search</field>
        <field name="model">ddmrp.warning.item</field>
        <field name="arch" type="xml">
            <search>
                <field name="buffer_id" />
                <field name="product_id" />
                <field name="location_id" groups="stock.group_stock_multi_locations" />
                <field name="severity" />
                <separator />
                <group expand="0" string="Group By">
                    <filter
                        string="Buffer"
                        name="groupby_buffer"
                        domain="[]"
                        context="{'group_by':'buffer_id'}"
                    />
                    <filter
                        string="Severity"
                        name="groupby_severity"
                        domain="[]"
                        context="{'group_by':'severity'}"
                    />
                    <filter
                        string="Definition"
                        name="groupby_warning_definition_id"
                        domain="[]"
                        context="{'group_by':'warning_definition_id'}"
                    />
                </group>
            </search>
        </field>
    </record>
    <record id="action_ddmrp_warning_item" model="ir.actions.act_window">
        <field name="name">DDMRP Warning Items</field>
        <field name="res_model">ddmrp.warning.item</field>
        <field name="view_mode">tree,form</field>
    </record>
    <menuitem
        name="DDMRP Warnings"
        parent="stock.menu_warehouse_report"
        id="menu_ddmrp_warning_item"
        action="action_ddmrp_warning_item"
        sequence="150"
    />
</odoo>
