<odoo>
    <record id="action_stock_test_tree" model="ir.actions.act_window">
        <field name="name">Stock Exception Rules</field>
        <field name="res_model">exception.rule</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="base_exception.view_exception_rule_tree" />
        <field
            name="domain"
        >[('model', 'in', ['stock.picking', 'stock.move', 'stock.move.line'])]</field>
        <field
            name="context"
        >{'active_test': False, 'default_model' : 'stock.picking'}</field>
    </record>
    <menuitem
        action="action_stock_test_tree"
        id="menu_stock_test"
        parent="stock.menu_stock_config_settings"
    />
    <record id="view_picking_form" model="ir.ui.view">
        <field name="name">stock_exception.view_picking_form</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.view_picking_form" />
        <field name="arch" type="xml">
            <sheet position="before">
                <div
                    class="alert alert-danger"
                    role="alert"
                    style="margin-bottom:0px;"
                    attrs="{'invisible': [('exceptions_summary', '=', False)]}"
                >
                    <p>
                        <strong
                        >There are exceptions blocking this stock picking:</strong>
                    </p>
                    <field name="exceptions_summary" />
                    <button
                        name="action_ignore_exceptions"
                        type="object"
                        class="btn-danger"
                        string="Ignore Exceptions"
                        help="Click here to be able to confirm this stock picking regardless of the exceptions."
                        groups="base_exception.group_exception_rule_manager"
                    />
                </div>
            </sheet>
            <xpath expr="//field[@name='date_deadline']/.." position="inside">
                <field
                    name="ignore_exception"
                    states="waiting,confirmed,assigned"
                    groups='base_exception.group_exception_rule_manager'
                />
                <field name="exception_ids" widget="many2many_tags" readonly="True" />
            </xpath>
        </field>
    </record>
    <record id="vpicktree" model="ir.ui.view">
        <field name="name">stock_exception.vpicktree</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.vpicktree" />
        <field name="arch" type="xml">
            <field name="state" position="after">
                <field name="main_exception_id" />
            </field>
        </field>
    </record>
    <record id="view_picking_internal_search" model="ir.ui.view">
        <field name="name">stock_exception.view_picking_internal_search</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock.view_picking_internal_search" />
        <field name="arch" type="xml">
            <filter name="activities_exception" position="after">
                <separator orientation="vertical" />
                <filter
                    icon="fa-exclamation-circle"
                    name="tofix"
                    string="Blocked in Draft"
                    domain="[('main_exception_id','!=',False)]"
                />
            </filter>
        </field>
    </record>
</odoo>
