nfu/website_decimal_quantity/views/website_sale_templates.xml

31 lines
1.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- This template replaces the default quantity selector with a text input field
that allows for decimal values. -->
<template
id="product_quantity_decimal"
inherit_id="website_sale.product_quantity"
name="Select Quantity"
priority="99"
>
<xpath expr="//input[@name='add_qty']" position="replace">
<input
type="text"
class="form-control quantity text-center"
data-min="0.1"
name="add_qty"
t-att-value="add_qty or 1"
/>
</xpath>
</template>
<!-- This template replaces the default cart popover button with a button that
displays the total number of items in the cart with one decimal point precision. -->
<template id="cart_popover_decimal" inherit_id="website_sale.cart_popover" name="Cart Popover">
<xpath expr="//a[hasclass('btn-primary')]/span[hasclass('o_wsale_cart_quantity')]" position="attributes">
<attribute
name="t-esc"
>round(sum(website_sale_order.mapped('website_order_line.product_uom_qty')), 1)</attribute>
</xpath>
</template>
</odoo>