如何正确继承销售点模板并添加新数据以在 odoo 12 的销售点会话中显示

how to inherit point of sale template properly and add new data to display in point of sale session in odoo 12

您好,我曾尝试继承销售点模块中的 pos.xml 我想在总计和税收

下方显示新数据

我不知道我做错了什么

这是我的代码

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <template id="attempt_inherit_pos_template" inherit_id="point_of_sale.template">
            <xpath expr="//div[@class='subentry']" position="replace">
                <div class='new_subentry'>Additional Discount: </div>
            </xpath>
        </template>
    </data>
</odoo>

我在我的清单文件中添加了"qweb" : ["static/src/xml/attempt_inherit_pos_qweb.xml",],这个

我在 POS 会话屏幕中看不到任何变化

我做错了什么?

错误地继承了pos模板,

<template id="Orderline_cust" inherit_id="point_of_sale.Orderline">
    <!-- Xpath -->
</template>

谢谢

您需要使用 template inheritance 来更改 OrderWidget 模板。

attempt_inherit_pos_qweb.xml的内容改为:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-extend="OrderWidget">
        <!--         Taxes selector -->
        <t t-jquery="div.subentry" t-operation="after">
            <!-- Your xml code here -->
        </t>
    </t>
</templates>