Do you have an example of how to pass a value from a controller to an OWL template? I haven't found a single article discussing this.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
Hi,
For passing the value from the controller to the template, try to use the following code:
Python:# -*- coding: utf-8 -*-
from odoo import http
from odoo.http import request
class ExampleController(http.Controller):
@http.route('/example', auth='public', website=True)
def example(self):
message = "Hello, World!"
return request.render('your_module.example_template', {'message': message})
XML:
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="example_template" name="Example Template">
<t t-call="website.layout">
<div id="wrap">
<div class="container">
<h1 t-esc="message"/>
</div>
</div>
</t>
</template>
</odoo>
Hope it helps.
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
1
jun. 24
|
1521 | ||
|
2
jul. 25
|
506 | ||
|
0
jan. 25
|
921 | ||
|
0
dec. 24
|
1703 | ||
|
0
sep. 24
|
932 |