add website_decimal_quantity

This commit is contained in:
Luis 2026-10-02 10:05:22 +02:00
parent 0323b6672e
commit 9d69e5f095
67 changed files with 1858 additions and 0 deletions

View file

@ -0,0 +1,32 @@
<?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" inherit_id="website_sale.product_quantity" name="Product Quantity Decimal Support">
<xpath expr="//input[@name='add_qty']" position="attributes">
<attribute name="t-att-data-allow-decimal">product.uom_id.category_id.allow_decimal_quantity and 'true' or 'false'</attribute>
<attribute name="t-att-data-min">product.uom_id.category_id.allow_decimal_quantity and '0.1' or '1'</attribute>
</xpath>
</template>
<template id="cart_lines_decimal" inherit_id="website_sale.cart_lines" name="Cart Lines Decimal Support">
<xpath expr="//input[hasclass('js_quantity','form-control','quantity')]" position="attributes">
<attribute name="t-att-data-allow-decimal">line.product_uom.category_id.allow_decimal_quantity and 'true' or 'false'</attribute>
<attribute name="t-att-data-min">line.product_uom.category_id.allow_decimal_quantity and '0.1' or '1'</attribute>
</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')]" position="replace">
<a role="button" class="btn btn-primary" href="/shop/cart">
View Cart (
<span class="o_wsale_cart_quantity"
t-esc="round(sum(website_sale_order.mapped('website_order_line.product_uom_qty')), 1)"/>
item(s))
</a>
</xpath>
</template>
</odoo>