<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017-2020 ForgeFlow S.L.
     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
    <record id="view_stock_quant_tree_inventory_editable" model="ir.ui.view">
        <field name="model">stock.quant</field>
        <field name="inherit_id" ref="stock.view_stock_quant_tree_inventory_editable" />
        <field name="arch" type="xml">
            <button
                name="stock.action_stock_inventory_adjustement_name"
                position="attributes"
            >
                <attribute
                    name="groups"
                >stock_inventory_discrepancy.group_stock_inventory_validation</attribute>
            </button>
            <button name="action_apply_inventory" position="attributes">
                <attribute
                    name="groups"
                >stock_inventory_discrepancy.group_stock_inventory_validation</attribute>
            </button>
            <field name="inventory_diff_quantity" position="after">
                <field
                    name="discrepancy_percent"
                    attrs="{'invisible': ['|', ('inventory_quantity_set', '=', False), ('quantity', '=', False)]}"
                    decoration-bf="inventory_quantity_set and has_over_discrepancy"
                    optional="hide"
                />
                <field name="discrepancy_threshold" optional="hide" />
                <field name="has_over_discrepancy" invisible="1" />
            </field>
            <xpath expr="//tree" position="attributes">
                <attribute
                    name="decoration-danger"
                >inventory_quantity_set and (inventory_quantity &lt; 0 or has_over_discrepancy)</attribute>
            </xpath>
        </field>
    </record>

    <record id="quant_search_last_has_over_discrepancy" model="ir.ui.view">
        <field name="name">stock.quant.last_has_over_discrepancy.search</field>
        <field name="model">stock.quant</field>
        <field name="inherit_id" ref="stock.quant_search_view" />
        <field eval="10" name="priority" />
        <field name="arch" type="xml">
            <field name="owner_id" position="after">
                <field name="has_over_discrepancy" />
            </field>
            <filter name="internal_loc" position="after">
                <filter
                    name='has_over_discrepancy'
                    string="Over Discrepancy"
                    domain="[('has_over_discrepancy','=', True)]"
                />
            </filter>
        </field>
    </record>
</odoo>
