Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3749 Представления

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!

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
февр. 21
4929
0
нояб. 24
1040
0
февр. 24
1034
0
дек. 20
2895
1
июн. 18
5921