Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
5086 Tampilan

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
Buang

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

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

Penulis

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

AssertionError: Document does not comply with schema

Post Terkait Replies Tampilan Aktivitas
1
Agu 24
1714
1
Mar 24
1340
18
Des 22
36916
2
Des 22
32077
2
Nov 21
8197