Welcome!
This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.
chamar variavel ou função através de um template
Chame o método na view ou template de qualquer modelo (pode ser vários modelos sem herdar nenhum) e coloque o resultado na variável
<t t-set="order" t-value="website.sale_get_order()"/>
Aqui, website é o modulo chamado e sale_get_order() é uma função.
<t t-set="foobar" t-value="request.env['ir.config_parameter'].get_param('my_module.foobar')"/>
Aqui, request é uma variável, ir.config_parameter a tabela, get_param a função e 'my_module.foobar' um argumento.
Mostrar valor da variável
<p><t t-esc="foobar"/></p>
Se a variavel for binaria (imagem)
t-attf-src="data:image/png;base64, #{o.barcode}"
t-att-src="'data:image/png;base64,%s' % to_text(o.barcode)"
t-att-value="my_var"
my_var é o elemento do dicionário de 'valores' (segundo argumento do render ()).
fonte : odoo-development.readthedocs.io
Your Answer
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
Keep Informed
About This Community
Moderation Tools
Question tools
Stats
Asked: 10/13/21, 4:27 PM |
Seen: 571 times |
Last updated: 5/4/22, 6:36 PM |