From 8e5a4a39e0dda792af67942769c9cf0f0f1be155 Mon Sep 17 00:00:00 2001 From: snt Date: Mon, 16 Feb 2026 23:21:22 +0100 Subject: [PATCH] [FIX] website_sale_aplicoop: Simplify price handling using Python or operator in t-set The previous approach using complex if-else expressions in t-set variables was causing QWeb parsing issues (TypeError: 'NoneType' object is not callable). Solution: Leverage Python's 'or' operator in t-set variable computation - Create intermediate variable: display_price_value = price_info.get('price') - Then compute: display_price = display_price_value or product.list_price or 0.0 - Use simple reference in t-attf attribute: {{ display_price }} This approach: 1. Avoids complex nested conditionals in t-set 2. Uses Python's native short-circuit evaluation for None-safety 3. Keeps template expressions simple and readable 4. Properly handles fallback values in the right evaluation order Testing: Module loads without errors, template renders successfully. --- website_sale_aplicoop/views/website_templates.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/website_sale_aplicoop/views/website_templates.xml b/website_sale_aplicoop/views/website_templates.xml index 9e541e7..e0de944 100644 --- a/website_sale_aplicoop/views/website_templates.xml +++ b/website_sale_aplicoop/views/website_templates.xml @@ -1165,9 +1165,13 @@ t-set="price_info" t-value="product_price_info.get(product.id, {})" /> + -