This question has been flagged
2 Replies
4560 Views

Hi, new to Odoo I have made a template in custom XML 
my_addon/static/src/eg.xml


< templates id = "template" xml : space = "preserve" > 

< t t-name = "Chrome" >
< div class = "pos" >
< div class = "pos-topheader" >
< div class = "pos- branding " >
< img class =" pos-logo " src =" / point_of_sale / static / src / img / logo.png " />
<span class = "placeholder-UsernameWidget" > </ span >
</ div >
< div class = "pos-rightheader" >
< span class = "placeholder-OrderSelectorWidget" > </ span >
<! - here goes header buttons ->
</ div > </ div > </templates>
What I was trying to do is inherit it in another custom module.I have tried the below code
< template id = "jfm_mod_receipt" name = "jfm_mod_receipt check" inherit_id = "point_of_sale.template" > 
< xpath expr = "// div [@ class = 'pos-sale-ticket']" position = "after" >
< div class = "pos-center-align" > < t t-esc = "moment (). format ('L LT')" /> </ div >
</ xpath >
</ template >
but it is showing error ParseError: "External ID not found in the system: point_of_sale.template" while parsing None:4, near <data name="jfm_mod_receipt check" inherit_id="point_of_sale.template"> <xpath expr="//div[@class='pos-sale-ticket']" position="after"> <div class="pos-center-align"><t t-esc="moment().format('L LT')"/></div> </xpath> </data> Kindly someone help me out
Avatar
Discard
Best Answer

Hello Arsalan,

You can inherit template in such way:-

<templates id="template" inherit_id="point_of_sale.template">

    <t t-extend="Chrome">

        <!--<t t-jquery="jquery_selector" t-operation="operation">-->

    </t>

</templates>

Extend templates using <t t-extend="template_name"> followed by one or more <t t-jquery="jquery_selector" t-operation="operation"> which acts kinda like xpath, but client side template inheritance.

And also in the manifest file, add 'point_of_sale' as depends and XML file in qweb.

Thank you!

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

    

Avatar
Discard
Best Answer

Hello Arsalan,

Try this Way :

<template id="jfm_mod_receipt" name="jfm_mod_receipt check" inherit_id="template_rooted_module_name.template">


   <xpath expr="//div [hasclass('pos-sale-ticket')]" position="after">


       <div class ="pos-center-align">


           <t t-esc ="moment().format('L LT')"/>


       </div>


   </xpath>


</template>


Regards

Avatar
Discard

What do you mean by template_rooted? Can you give further details?