[FIX] website_sale_aplicoop: Replace or operators with t-set safe variables in QWeb template
The eskaera_shop_products template was using 'or' operators directly in t-attf-* attributes, which causes QWeb parsing issues when values are None. Solution: Pre-compute safe variable values using t-set before the form element - safe_display_price: Handles None values for display_price, falls back to product.list_price, then 0 - safe_uom_category: Safely checks product.uom_id and category_id chain before accessing name This pattern is more QWeb-compatible and avoids inline operator evaluation issues that were causing "TypeError: 'NoneType' object is not callable" errors. Tested: Template loads successfully, safe variables render correctly.
This commit is contained in:
parent
df572337d6
commit
0a0cf5a018
1 changed files with 10 additions and 2 deletions
|
|
@ -1211,13 +1211,21 @@
|
||||||
</p>
|
</p>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
|
<t
|
||||||
|
t-set="safe_display_price"
|
||||||
|
t-value="display_price if display_price else (product.list_price if product.list_price else 0)"
|
||||||
|
/>
|
||||||
|
<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 ''"
|
||||||
|
/>
|
||||||
<form
|
<form
|
||||||
class="add-to-cart-form"
|
class="add-to-cart-form"
|
||||||
t-attf-data-order-id="{{ group_order.id if 'group_order' in locals() else '' }}"
|
t-attf-data-order-id="{{ group_order.id if 'group_order' in locals() else '' }}"
|
||||||
t-attf-data-product-id="{{ product.id }}"
|
t-attf-data-product-id="{{ product.id }}"
|
||||||
t-attf-data-product-name="{{ product.name }}"
|
t-attf-data-product-name="{{ product.name }}"
|
||||||
t-attf-data-product-price="{{ display_price or product.list_price or 0 }}"
|
t-attf-data-product-price="{{ safe_display_price }}"
|
||||||
t-attf-data-uom-category="{{ product.uom_id.category_id.name if product.uom_id.category_id else '' }}"
|
t-attf-data-uom-category="{{ safe_uom_category }}"
|
||||||
>
|
>
|
||||||
<div class="qty-control">
|
<div class="qty-control">
|
||||||
<label
|
<label
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue