<?xml version="1.0" encoding="UTF-8"?>

<templates xml:space="preserve">

    <t t-name="sale.SaleProductField" t-inherit="web.Many2OneField" t-inherit-mode="primary">
        <!-- Make the product label clickable (to open its form view) when the user cannot
            access it through the external button (because the product/line is readonly) -->
        <xpath expr="//t[@t-if='!props.canOpen']" position="attributes">
            <attribute name="t-if">
                !isProductClickable
            </attribute>
        </xpath>
        <!-- Show configuration button for custom lines/products -->
        <xpath expr="//t[@t-if='hasExternalButton']" position="before">
            <t t-if="hasConfigurationButton">
                <button
                    type="button"
                    t-att-class="configurationButtonIcon"
                    tabindex="-1"
                    draggable="false"
                    t-att-aria-label="configurationButtonHelp"
                    t-att-data-tooltip="configurationButtonHelp"
                    t-on-click="onEditConfiguration"/>
            </t>
        </xpath>
    </t>

</templates>
