<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <!-- Product Template Form Inheritance -->
    <record id="product_template_form_view_rental" model="ir.ui.view">
        <field name="name">product.template.form.inherit.rental</field>
        <field name="model">product.template</field>
        <field name="inherit_id" ref="product.product_template_only_form_view"/>
        <field name="arch" type="xml">
            <xpath expr="//div[@name='options']" position="inside">
                <span class="d-inline-block">
                    <field name="is_rental"/>
                    <label for="is_rental"/>
                </span>
            </xpath>
            <xpath expr="//notebook" position="inside">
                <page string="Event Rental" name="event_rental" invisible="not is_rental">
                    <group>
                        <group>
                            <field name="rental_price_per_day" widget="monetary" options="{'currency_field': 'currency_id'}"/>
                        </group>
                    </group>
                    <group string="Rental Terms &amp; Conditions">
                        <field name="rental_terms" colspan="2" nolabel="1" placeholder="Define terms specific to renting this item..." class="oe-bordered-editor"/>
                    </group>
                </page>
            </xpath>
        </field>
    </record>

    <!-- Product Template Search Inheritance -->
    <record id="product_template_search_view_rental" model="ir.ui.view">
        <field name="name">product.template.search.inherit.rental</field>
        <field name="model">product.template</field>
        <field name="inherit_id" ref="product.product_template_search_view"/>
        <field name="arch" type="xml">
            <xpath expr="//filter[@name='filter_to_sell']" position="after">
                <filter string="Can be Rented" name="filter_is_rental" domain="[('is_rental', '=', True)]"/>
            </xpath>
        </field>
    </record>
</odoo>
