如何解决如何在 POS 客户视图中添加新的跨度?奥多14
我想在 POS 客户视图中添加一个跨度。我尝试使用此代码,但不起作用。
//customer.xml
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="point_of_sale.template" xml:space="preserve">
<t t-extend="ClientDetailsEdit">
<t t-jquery=".client-details-right" t-operation="append">
<div class="client-detail">
<span class="label">Test</span>
</div>
</t>
</t>
</templates>
//manifest.py
"qweb": [
'static/src/xml/customer.xml',],
我的代码有什么问题?请问有什么帮助吗?谢谢。
解决方法
如果我在 Odoo 插件中查看扩展的示例,模板声明如下
<templates id="template" xml:space="preserve">
在你的情况下,你像这样声明模板
<templates id="point_of_sale.template" xml:space="preserve">
在您的模块中,当您编写此 id="point_of_sale.template"
时,Odoo 将覆盖基本模板。但是在模板的逻辑中,t-name 在所有模块中必须是唯一的。
如果我按照这个逻辑,你应该写:
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t t-extend="ClientDetailsEdit">
<t t-jquery=".client-details-right" t-operation="append">
<div class="client-detail">
<span class="label">Test</span>
</div>
</t>
</t>
</templates>
在此解决方案中,您不会覆盖模板 point_of_sale.template 但您将创建一个新模板将扩展 t-name ClientDetailsEdit
PS:更多信息我看 addons/iap/statis/src/xml/iap_template.xml
代码是
<?xml version="1.0" encoding="UTF-8"?>
<template id="template" xml:space="preserve"> <!-- Id is only template -->
<!-- LAYOUT TEMPLATES -->
<div t-name="iap.redirect_to_odoo_credit">
<t t-if="data.body">
<div t-raw="data.body"/>
</t>
<t t-if="!data.body">
<t t-if="data.message">
<span t-esc="data.message"/>
</t>
<t t-if="!data.message">
<span>Insufficient credit to perform this service.</span>
</t>
</t>
</div>
<t t-extend="DashboardMain"> <!-- And extend template here -->
<t t-jquery=".o_web_settings_apps" t-operation="after">
<div class="o_web_settings_iap"></div>
</t>
</t>
<div t-name="iap.buy_more_credits" class="mt-2 row">
<div class="col-sm">
<button class="btn btn-link buy_credits"><i class="fa fa-arrow-right"/> Buy credits</button>
</div>
</div>
</template>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。