Reputation: 322
i have a piece of code having variable in .py file but i don't know how to call the varibale inside xml template
.xml file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="menu_secondary" name="group_js menu" inherit_id="web.menu_secondary">
<xpath expr="." position="inside">
<span t-field="o.test"></span>
</xpath>
</template>
</data>
</openerp>
.py file
from openerp.osv import fields,osv, expression
class group_js(osv.osv):
_name = "group_js"
_description = "Group JS"
def test(self):
temp_var = "HELLO"
return temp_var
so , any one have any idea please share with me
Thanks
Upvotes: 0
Views: 3106
Reputation: 31
If it is in the same model then you can replace your template using the following code.
<template id="menu_secondary" name="group_js menu" inherit_id="web.menu_secondary">
<xpath expr="." position="inside">
<span t-esc="o.test()" />
</xpath>
</template>
Try it, and it may be work for you.
Upvotes: 1