Reputation: 11
I am tying to inherit a template in point_of_sale screen so that i can change the function the "Invoice" button is targeting. Here is the template i am trying to inherit
<templates id="template" xml:space="preserve">
<t t-name="point_of_sale.PaymentScreenButtons">
<div class="payment-buttons d-flex flex-column flex-wrap">
<button class="button js_invoice btn btn-light py-3 text-start rounded-0 border-bottom" t-att-class="{ 'highlight text-bg-primary': currentOrder.is_to_invoice() }"
t-on-click="toggleIsToInvoice">
<i class="fa fa-file-text-o me-2" />Invoice
</button>
</div>
</t>
</templates>
Here’s a snippet of my XML code
<odoo>
<template id="extend_payment_screen_buttons" inherit_id="point_of_sale.template">
<xpath expr="//button[contains(@class, 'js_invoice')]" position="replace">
<button class="button js_invoice btn btn-light py-3 text-start rounded-0 border-bottom"
t-att-class="{ 'highlight text-bg-primary': currentOrder.is_to_invoice() }"
t-on-click="createAndPrintInvoice">
<i class="fa fa-file-text-o me-2"/>Invoice
</button>
</xpath>
</template>
</odoo>
The error i am getting is: ValueError: External ID not found in the system: point_of_sale.template
Can Someone help?
I tried changing the ID but still nothing.
Upvotes: 0
Views: 392
Reputation: 378
Try exending it by the name, in your xml template file...
<templates xml:space="preserve">
<t t-name="my_module.PaymentScreenButtons" t-inherit="point_of_sale.PaymentScreenButtons" t-inherit-mode="extension" owl="1">
<xpath expr="//button[hasClass('js_invoice')]" position="replace">
<button class="button js_invoice btn btn-light py-3 text-start rounded-0 border-bottom"
t-att-class="{ 'highlight text-bg-primary': currentOrder.is_to_invoice() }"
t-on-click="createAndPrintInvoice">
<i class="fa fa-file-text-o me-2"/>Invoice
</button>
</xpath>
</t>
</templates>
The createAndPrintInvoice function and currentOrder must exist in the payment_screen.js otherwise you must patch the script and create them to be able to use them.
You can check the official documentation for more details
Upvotes: 0