Updated to reflect the final, working solution pattern:
Key improvements:
- Pattern 1 now emphasizes Extract → Fallback approach (RECOMMENDED)
- Clarified why nested conditionals fail (QWeb parser limitations)
- Documented that Python's 'or' operator is more reliable than 'if-else'
- Updated Common Pitfalls section with tested solutions
- Added step-by-step explanations for why each pattern works
The refined approach:
1. Extract value (might be None)
2. Apply fallbacks using 'or' operator
3. Use simple variable reference in attributes
This pattern is battle-tested and production-ready.
- FIX_TEMPLATE_ERROR_SUMMARY.md: Complete analysis of the website_sale_aplicoop template error and its resolution
* Root cause: QWeb parsing issues with 'or' operators in t-attf-* attributes
* Solution: Pre-compute safe variables using t-set before form element
* Verification: Template loads successfully, variables render correctly
* Git commits: df57233 (first attempt), 0a0cf5a (final fix)
- QWEB_BEST_PRACTICES.md: Comprehensive guide for QWeb template development
* Attribute expression best practices
* None/null safety patterns (3 patterns with examples)
* Variable computation patterns (3 patterns with examples)
* Common pitfalls and solutions
* Real-world examples (e-commerce, nested data, conditional styling)
* Summary table and validation tools
These documents provide immediate reference for QWeb issues and establish
standards for template development in Odoo 18 projects.