[FIX] website_sale_aplicoop: Move template logic to controller for QWeb compatibility

This fixes the persistent 'TypeError: NoneType object is not callable' error
by moving all complex conditional logic out of the template and into the
Python controller.

QWeb has strict parsing limitations - it fails on:
- Complex nested conditionals in t-set
- Chained 'or' operators in t-attf-* attributes
- Deep object attribute chains (uom_id.category_id.name)

Solution: Pre-process all display values in controller via _prepare_product_display_info()
which creates product_display_info dict with safe values ready for template.

Template now uses simple dict.get() calls without any conditional logic.
This commit is contained in:
snt 2026-02-16 23:28:36 +01:00
parent e29d7e41d4
commit 5721687488
2 changed files with 55 additions and 10 deletions

View file

@ -1161,17 +1161,9 @@
</small>
</p>
</t>
<t
t-set="price_info"
t-value="product_price_info.get(product.id, {})"
/>
<t
t-set="display_price_value"
t-value="price_info.get('price')"
/>
<t
t-set="display_price"
t-value="display_price_value or product.list_price or 0.0"
t-value="product_display_info.get(product.id, {}).get('display_price', 0.0)"
/>
<t
t-set="base_price"
@ -1217,7 +1209,7 @@
</div>
<t
t-set="safe_uom_category"
t-value="product.uom_id.category_id.name if (product.uom_id and product.uom_id.category_id) else ''"
t-value="product_display_info.get(product.id, {}).get('safe_uom_category', '')"
/>
<form
class="add-to-cart-form"