Ir al contenido
Menú
Se marcó esta pregunta
5068 Vistas

Hello, I want to inherit base common button template in custom module. I work with odoo V10
A try this : 

<?xml version="1.0" encoding="UTF-8"?>

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

<xpath expr="//button" position="relace">

<button type="button" t-attf-class="btn btn-sm #{widget.node.attrs.class or ''}"

t-att-style="widget.node.attrs.style"

t-att-tabindex="widget.node.attrs.tabindex"

t-att-autofocus="widget.node.attrs.autofocus"

t-att-accesskey="widget.node.attrs.accesskey">

<t t-if="widget.node.attrs.icon">

<img t-if="!widget.fa_icon" t-att-src="widget.node.attrs.icon" style="color:green"/>

<div t-if="widget.fa_icon" t-attf-class="fa fa-fw #{widget.node.attrs.icon} o_button_icon" style="color:green"/>

</t>

<span t-if="widget.string"><t t-esc="widget.string"/></span>

</button>

</xpath>

</templates>

and this : 

<?xml version="1.0" encoding="UTF-8"?>

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

<t t-name="CapWidgetButton" t-extend="WidgetButton">

<t t-jquery='button' t-operation='replace'>

<button type="button" t-attf-class="btn btn-sm #{widget.node.attrs.class or ''}"

t-att-style="widget.node.attrs.style"

t-att-tabindex="widget.node.attrs.tabindex"

t-att-autofocus="widget.node.attrs.autofocus"

t-att-accesskey="widget.node.attrs.accesskey">

<t t-if="widget.node.attrs.icon">

<img t-if="!widget.fa_icon" t-att-src="widget.node.attrs.icon" style="color:green"/>

<div t-if="widget.fa_icon" t-attf-class="fa fa-fw #{widget.node.attrs.icon} o_button_icon" style="color:green"/>

</t>

<span t-if="widget.string"><t t-esc="widget.string"/></span>

</button>

</t>

</t>

</templates>

But i doesn't work. Have you any idea ?


Avatar
Descartar

First You Have to Inherit Template id(web.template) than Use x-path

and On This Line <xpath expr="//button" position="relace"> position="replace"

Autor

Thanks ! But it's not the problem, i've always the same error message :

AssertionError: Document does not comply with schema

Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 24
1679
1
mar 24
1323
18
dic 22
36893
2
dic 22
32049
2
nov 21
8156