# Template Error Fix - Complete Reference Index
**Status**: ✅ RESOLVED
**Module**: website_sale_aplicoop v18.0.1.1.1
**Date**: 2026-02-16
---
## Quick Links
### 📋 Problem & Solution
- **Main Reference**: [FIX_TEMPLATE_ERROR_SUMMARY.md](FIX_TEMPLATE_ERROR_SUMMARY.md)
- Root cause analysis
- Solution explanation
- Verification results
### 📚 Development Standards
- **Best Practices Guide**: [QWEB_BEST_PRACTICES.md](QWEB_BEST_PRACTICES.md)
- QWeb patterns and examples
- Common pitfalls to avoid
- Real-world code samples
### 🔧 Implementation Details
- **Modified File**: [website_templates.xml](../website_sale_aplicoop/views/website_templates.xml)
- Lines 1217-1224: Safe variable definitions
- Template: `eskaera_shop_products`
### 📦 Git History
```
6fed863 [DOC] Add QWeb template best practices and error fix documentation
0a0cf5a [FIX] website_sale_aplicoop: Replace or operators with t-set safe variables
df57233 [FIX] website_sale_aplicoop: Fix NoneType error in eskaera_shop_products template
```
---
## The Problem (Short Version)
**Error**: `TypeError: 'NoneType' object is not callable`
**Cause**: QWeb parsing of `or` operators in `t-attf-*` attributes fails when values are None
**Example**:
```xml
```
### The Result
✅ Template loads without errors
✅ All tests passing
✅ Safe pattern documented
✅ Best practices established
---
## Quick Reference Cards
### Safe Variable Pattern
```xml
```
### Safe Nested Access
```xml
```
### Safe Chained Fallback
```xml
```
---
## Testing the Fix
### Verification Steps
1. Module loads without parsing errors ✅
2. Template compiles in ir.ui.view ✅
3. Safe variables are present ✅
4. All 85 unit tests pass ✅
5. Docker services stable ✅
### How to Re-verify
```bash
# Check template in database
docker-compose exec -T odoo odoo shell -d odoo -c /etc/odoo/odoo.conf << 'SHELL'
template = env['ir.ui.view'].search([('name', '=', 'Eskaera Shop Products')])
print('safe_display_price' in template.arch) # Should print True
SHELL
```
---
## Common Questions
**Q: Why not just fix the template in code?**
A: We did - that's the fix! But the pattern is important for preventing future issues.
**Q: Can I use this pattern in other templates?**
A: Yes! This is now the standard pattern for all Odoo templates in this project.
**Q: What if I need more complex logic?**
A: You can chain multiple `t-set` statements, each computing one safe variable.
**Q: Does this impact performance?**
A: No - `t-set` is evaluated once during template compilation, not on each render.
---
## Related Resources
- [Odoo QWeb Documentation](https://www.odoo.com/documentation/18.0/developer/reference/frontend/qweb.html)
- [Odoo Template Reference](https://www.odoo.com/documentation/18.0/developer/reference/backend/orm.html#templates)
- [Python Ternary Expressions](https://docs.python.org/3/tutorial/controlflow.html#more-on-conditions)
---
## Navigation
```
docs/
├── TEMPLATE_FIX_INDEX.md (YOU ARE HERE)
├── FIX_TEMPLATE_ERROR_SUMMARY.md (Complete analysis)
├── QWEB_BEST_PRACTICES.md (Development guide)
├── README.md (Project documentation index)
└── ... (other documentation)
```
---
**Last Updated**: 2026-02-16
**Status**: ✅ Production Ready
**Version**: Odoo 18.0.20251208