[FIX] website_sale_aplicoop: Simplify order_id expression in form template
The expression 'group_order' in locals() is NOT safe in QWeb templates.
QWeb cannot reliably parse this kind of conditional logic in attributes.
Changed from:
t-attf-data-order-id="{{ group_order.id if 'group_order' in locals() else '' }}"
To:
Added t-set: <t t-set="order_id_safe" t-value="group_order.id if group_order else ''"/>
Use: t-attf-data-order-id="{{ order_id_safe }}"
This ensures:
- Logic is evaluated in Python (safe)
- Template receives simple variable (QWeb-safe)
- No complex expressions in t-attf-* attributes
Files Modified:
- website_sale_aplicoop/views/website_templates.xml
• Added order_id_safe variable definition
• Simplified form data-order-id attribute
This commit is contained in:
parent
4c1b18ec30
commit
40db038e15
1 changed files with 5 additions and 1 deletions
|
|
@ -1215,9 +1215,13 @@
|
|||
t-set="safe_uom_category"
|
||||
t-value="product_display_info.get(product.id, {}).get('safe_uom_category', '')"
|
||||
/>
|
||||
<t
|
||||
t-set="order_id_safe"
|
||||
t-value="group_order.id if group_order else ''"
|
||||
/>
|
||||
<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="{{ order_id_safe }}"
|
||||
t-attf-data-product-id="{{ product.id }}"
|
||||
t-attf-data-product-name="{{ product.name }}"
|
||||
t-attf-data-product-price="{{ display_price }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue