Last active
December 19, 2023 13:06
-
-
Save ppa-odoo/73c091e2fa4a4341dcb485ab6f0920ba to your computer and use it in GitHub Desktop.
Odoo: How to inherit <templates> of web module?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REF LINK: https://www.odoo.com/forum/help-1/question/odoo10-how-to-inherit-templates-of-web-module-119140#answer-119142 | |
This is main template: | |
<template id="template" xml:space="preserve"> | |
<t t-name="DemoExample"> | |
<div class="demo-one"> | |
<p>odoo</p> | |
</div> | |
</t> | |
</template> | |
How To Inherit | |
---------------------- | |
Template file :-> demo_template.xml | |
<template id="template" xml:space="preserve"> | |
<t t-name="DemoExample" t-extend="DemoExample"> | |
<t t-jquery='.demo-one' t-operation='replace'> | |
<p>Your Company Name</p> | |
</t> | |
</t> | |
</template> | |
----------------------------------------------------- | |
<!- Loaded XML files inside java script code --> | |
----------------------------------------------------- | |
JS file :--> demo_example.js | |
------------------------------------------------------------------------- | |
put the following JS Code in demo_example.js file: | |
------------------------------------------------------------------------- | |
odoo.define('module_name.name_of_fetures', function (require) { | |
'use strict'; | |
var core = require('web.core'); | |
var ajax = require('web.ajax'); | |
var qweb = core.qweb; | |
ajax.loadXML('/module_name/static/src/xml/demo_template.xml', qweb); | |
}); | |
----------------------------------- | |
Loading of Javascript file | |
----------------------------------- | |
<template id="demo_example_ext_js" name="Demo Example Ext Js" inherit_id="web.assets_backend"> | |
<xpath expr="." position="inside"> | |
<script type="text/javascript" src="/module_name/static/js/demo_example.js"></script> | |
</xpath> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi all i want to change tooltip question marker to "!" how to inherit templates to change this on
there is source code in: addons/web/static/src/views/form/form_lable.xml
and source code is:
please help me tnx