[fix] make max qty work with the website_decimal_qty module
This commit is contained in:
parent
67cba5f268
commit
af4af89c1b
3 changed files with 11 additions and 11 deletions
|
|
@ -5,7 +5,7 @@
|
|||
"website": "https://www.bakeup.org",
|
||||
"category": "website",
|
||||
"version": "16.0.1.0.0",
|
||||
"depends": ["website_sale", "nfu_sale_order_batch_packaging"],
|
||||
"depends": ["website_sale", "nfu_sale_order_batch_packaging", "website_decimal_quantity"],
|
||||
"data": ["views/product_template_views.xml", "views/templates.xml"],
|
||||
"assets": {"web.assets_frontend": ["nfu_ecommerce/static/src/js/website_sale.js"]},
|
||||
"license": "LGPL-3",
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ odoo.define("nfu_ecommerce.website_max_qty", function (require) {
|
|||
productIDs.push($(elem).find("span[data-product-id]").data("product-id"));
|
||||
});
|
||||
$input.data("update_change", true);
|
||||
var max_qty = parseInt($input.closest("tr").find('input[name="max-qty"]').val(), 10);
|
||||
var set_qty = parseInt($input.closest("tr").find('input[name!="max-qty"]').val(), 10);
|
||||
var max_qty = parseFloat($input.closest("tr").find('input[name="max-qty"]').val(), 10);
|
||||
var set_qty = parseFloat($input.closest("tr").find('input[name!="max-qty"]').val(), 10);
|
||||
if (max_qty < set_qty) {
|
||||
max_qty = set_qty;
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ odoo.define("nfu_ecommerce.website_max_qty", function (require) {
|
|||
},
|
||||
}).then(function (data) {
|
||||
$input.data("update_change", false);
|
||||
var check_value = parseInt($input.val() || 0, 10);
|
||||
var check_value = parseFloat($input.val() || 0, 10);
|
||||
if (isNaN(check_value)) {
|
||||
check_value = 1;
|
||||
}
|
||||
|
|
@ -44,9 +44,9 @@ odoo.define("nfu_ecommerce.website_max_qty", function (require) {
|
|||
}
|
||||
$input.val(data.quantity);
|
||||
$(".js_quantity[data-line-id=" + line_id + "]")
|
||||
.val(data.quantity)
|
||||
.text(data.quantity);
|
||||
|
||||
.val(data.quantity)
|
||||
.text(data.quantity);
|
||||
|
||||
wSaleUtils.updateCartNavBar(data);
|
||||
wSaleUtils.showWarning(data.warning);
|
||||
// Propagating the change to the express checkout forms
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@
|
|||
class="js_quantity form-control quantity"
|
||||
t-att-data-line-id="line.id"
|
||||
t-att-data-product-id="line.product_id.id"
|
||||
t-att-value="line.product_uom_max_qty and int(line.product_uom_max_qty) or int(line.product_uom_qty)"
|
||||
t-att-data-min="int(line.product_uom_qty)"
|
||||
t-att-value="line.product_uom_max_qty and line.product_uom_max_qty or line.product_uom_qty"
|
||||
t-att-data-min="line.product_uom_qty"
|
||||
/>
|
||||
<t t-if="line._get_shop_warning(clear=False)">
|
||||
<a t-attf-href="#" class="btn btn-link">
|
||||
|
|
@ -66,12 +66,12 @@
|
|||
class="js_quantity form-control quantity"
|
||||
t-att-data-line-id="line.id"
|
||||
t-att-data-product-id="line.product_id.id"
|
||||
t-att-value="int(line.product_uom_qty) == line.product_uom_qty and int(line.product_uom_qty) or line.product_uom_qty"
|
||||
t-att-value="line.product_uom_qty == line.product_uom_qty and line.product_uom_qty or line.product_uom_qty"
|
||||
/>
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<span class="text-muted w-100" t-esc="int(line.product_uom_qty)"/>
|
||||
<span class="text-muted w-100" t-esc="line.product_uom_qty"/>
|
||||
<input
|
||||
type="hidden"
|
||||
class="js_quantity form-control quantity"
|
||||
|
|
|
|||
Loading…
Reference in a new issue