Search code examples
xmlodooodoo-12

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


Hi I had tried to inherit the pos.xml in the point of sale module I want to display a new data just below the Total and Taxes

enter image description here

I don't know what im doing wrong

here's my code

<?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>

I added "qweb" : ["static/src/xml/attempt_inherit_pos_qweb.xml",], this in my manifest file

i can't see any changes in the POS session screen

what am i doing wrong?


Solution

  • You need to use template inheritance to alter OrderWidget template.

    Change the content of attempt_inherit_pos_qweb.xml to:

    <?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>