[FIX] website_sale_aplicoop: evitar x2 en carrito y mostrar /Kg en granel
This commit is contained in:
parent
6628e17fef
commit
7e13ffef07
3 changed files with 15 additions and 1 deletions
|
|
@ -367,7 +367,7 @@ class AplicoopWebsiteSale(WebsiteSale):
|
||||||
product_price_info: dict with price data keyed by product.id.
|
product_price_info: dict with price data keyed by product.id.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict with display_price, safe_uom_category, quantity_step
|
dict with display_price, safe_uom_category, quantity_step, price_unit_suffix
|
||||||
"""
|
"""
|
||||||
price_data = product_price_info.get(product.id, {})
|
price_data = product_price_info.get(product.id, {})
|
||||||
price = (
|
price = (
|
||||||
|
|
@ -379,6 +379,7 @@ class AplicoopWebsiteSale(WebsiteSale):
|
||||||
|
|
||||||
uom_category_name = ""
|
uom_category_name = ""
|
||||||
quantity_step = 1
|
quantity_step = 1
|
||||||
|
price_unit_suffix = ""
|
||||||
|
|
||||||
if product.uom_id:
|
if product.uom_id:
|
||||||
uom = product.uom_id.sudo()
|
uom = product.uom_id.sudo()
|
||||||
|
|
@ -404,6 +405,8 @@ class AplicoopWebsiteSale(WebsiteSale):
|
||||||
full_xmlid = f"{external_id.module}.{external_id.name}"
|
full_xmlid = f"{external_id.module}.{external_id.name}"
|
||||||
if full_xmlid in fractional_categories:
|
if full_xmlid in fractional_categories:
|
||||||
quantity_step = 0.1
|
quantity_step = 0.1
|
||||||
|
if full_xmlid == "uom.product_uom_categ_kgm":
|
||||||
|
price_unit_suffix = "/Kg"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.warning(
|
_logger.warning(
|
||||||
"_prepare_product_display_info: Error detecting UoM category XML ID for product %s: %s",
|
"_prepare_product_display_info: Error detecting UoM category XML ID for product %s: %s",
|
||||||
|
|
@ -415,6 +418,7 @@ class AplicoopWebsiteSale(WebsiteSale):
|
||||||
"display_price": price_safe,
|
"display_price": price_safe,
|
||||||
"safe_uom_category": uom_category_name,
|
"safe_uom_category": uom_category_name,
|
||||||
"quantity_step": quantity_step,
|
"quantity_step": quantity_step,
|
||||||
|
"price_unit_suffix": price_unit_suffix,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_pricing_info(self, product, pricelist, quantity=1.0, partner=None):
|
def _get_pricing_info(self, product, pricelist, quantity=1.0, partner=None):
|
||||||
|
|
|
||||||
|
|
@ -766,9 +766,14 @@
|
||||||
|
|
||||||
// Shared handler for add-to-cart to reuse across grid/document listeners
|
// Shared handler for add-to-cart to reuse across grid/document listeners
|
||||||
var handleAddToCart = function (e) {
|
var handleAddToCart = function (e) {
|
||||||
|
if (e._groupOrderAddToCartHandled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var cartBtn = e.target.closest(".add-to-cart-btn");
|
var cartBtn = e.target.closest(".add-to-cart-btn");
|
||||||
if (!cartBtn) return;
|
if (!cartBtn) return;
|
||||||
|
|
||||||
|
e._groupOrderAddToCartHandled = true;
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var form = cartBtn.closest(".add-to-cart-form");
|
var form = cartBtn.closest(".add-to-cart-form");
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
|
|
|
||||||
|
|
@ -615,6 +615,11 @@
|
||||||
<h6 class="card-text product-price-display">
|
<h6 class="card-text product-price-display">
|
||||||
<span class="product-price-main">
|
<span class="product-price-main">
|
||||||
<t t-esc="'%.2f' % display_price" /> €
|
<t t-esc="'%.2f' % display_price" /> €
|
||||||
|
<t t-if="product_display_info.get(product.id, {}).get('price_unit_suffix')">
|
||||||
|
<span class="ms-1">
|
||||||
|
<t t-esc="product_display_info.get(product.id, {}).get('price_unit_suffix')" />
|
||||||
|
</span>
|
||||||
|
</t>
|
||||||
</span>
|
</span>
|
||||||
<t t-if="price_info.get('has_discounted_price', False)">
|
<t t-if="price_info.get('has_discounted_price', False)">
|
||||||
<small class="text-muted text-decoration-line-through ms-1">
|
<small class="text-muted text-decoration-line-through ms-1">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue