[FIX] website_sale_aplicoop: translate cart labels safely

This commit is contained in:
snt 2026-03-31 16:18:40 +02:00
parent 603e6b6aa1
commit c17bd7eddd
4 changed files with 17 additions and 16 deletions

View file

@ -367,7 +367,8 @@ class AplicoopWebsiteSale(WebsiteSale):
product_price_info: dict with price data keyed by product.id.
Returns:
dict with display_price, safe_uom_category, quantity_step, price_unit_suffix
dict with display_price, safe_uom_category, quantity_step,
price_unit_suffix and translated accessibility labels.
"""
price_data = product_price_info.get(product.id, {})
price = (
@ -414,11 +415,18 @@ class AplicoopWebsiteSale(WebsiteSale):
str(e),
)
out_of_stock_label = request.env._("Out of stock")
add_to_cart_label = request.env._(
"Add %(product_name)s to cart", product_name=product.name
)
return {
"display_price": price_safe,
"safe_uom_category": uom_category_name,
"quantity_step": quantity_step,
"price_unit_suffix": price_unit_suffix,
"out_of_stock_label": out_of_stock_label,
"add_to_cart_label": add_to_cart_label,
}
def _get_pricing_info(self, product, pricelist, quantity=1.0, partner=None):