<?xml version="1.0" encoding="utf-8" ?>
<!-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3). -->
<odoo>
    <record id="stock_putaway_list" model="ir.ui.view">
        <field name="name">Add product_tmpl_id field</field>
        <field name="model">stock.putaway.rule</field>
        <field name="inherit_id" ref="stock.stock_putaway_list" />
        <field name="arch" type="xml">
            <field name="product_id" position="attributes">
                <attribute name="readonly">False</attribute>
                <attribute
                    name="attrs"
                >{'readonly': [('category_id', '!=', False)], 'required': [('category_id', '=', False),('product_tmpl_id', '=', False)]}</attribute>
            </field>
            <field name="category_id" position="attributes">
                <attribute name="readonly">False</attribute>
                <attribute
                    name="attrs"
                >{'readonly': ['|', ('product_id', '!=', False), ('product_tmpl_id', '!=', False)], 'required': [('product_id', '=', False),('product_tmpl_id', '=', False)]}</attribute>
            </field>
            <field name="product_id" position="before">
                <field
                    name="product_tmpl_id"
                    attrs="{'readonly': [('category_id', '!=', False)], 'required': [('category_id', '=', False)]}"
                    options="{'no_create': True, 'no_open': True}"
                    force_save="1"
                />
            </field>
        </field>
    </record>
</odoo>
