Skip to Content
Menu
This question has been flagged
1 Reply
2932 Views

In the official document: https://www.odoo.com/documentation/12.0/reference/qweb.html, It says "esc takes an expression, evaluates it and prints the content", where does this value come from? From my_module.py in module or from javascript in the same xml?

To be more specific, I have a CharField called "my_link" (let's suppose its id is "my_app.my_module.my_link"), which is a link like "//www.odoo.com" in my_module.py, and I want to transfer it to my frontend page my_frontend.xml, and engage it in the html iframe code as the value of the attribute "src", so what should I do?

My xml is most likely to this: (sorry for not showing the indent, the editor eats them all)

<record model="ir.ui.view" id="my_app.my_module_form">
<field name="name">My Module Form</field>
<field name="model">my_app.my_module</field>
<field name="arch" type="xml">
<form>
<sheet>
<t t-call="website.layout">
<body>
<div>
<!-- Below is where I want to transfer my value to -->
<iframe id="preview" t-att-src="row {{ my_app.my_module.my_link }}" scrolling="no"></iframe>
</div>
</body>
</t>
</sheet>
</form>
</record>

When I tried to run this xml, it just gives me the same code in the browser

<iframe id="preview" t-att-src="row {{ my_app.my_module.my_link }}" scrolling="no"></iframe>

without render the value in it.

Anyone has some nice idea about this? Thanks a lot!

Avatar
Discard
Best Answer

Hi,

If you are looking how to pass the value from the python side to the website page, you can write a controller for the page and pass the value to the template from it.

If you take the example in the Odoo, there is page with the url '/shop' in the eCommerce. While this URL is loading there is a route with the given url will be there in the controller, and it will get called and return necessary values to the template to render the page.


Please see this blog explaining the same, here the author is showing how the sale order details is listed in a web page using the controller, have a look at this:  Web Controllers in Odoo

Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
Feb 21
3817
0
Nov 24
89
0
Feb 24
255
0
Dec 20
2133
1
Jun 18
5030