Hi all!
I'm trying to add a custom button next to the "Print Full Receipt" button, but it's not showing up. Here's my implementation:
Structure:
test_app/
├── __init__.py # Empty file
├── __manifest__.py
└── static/
└── src/
├── js/
│ └── receipt_screen.js
└── xml/
└── receipt_screen.xml
__manifest__.py
{
'name': 'Test App',
'version': '1.0',
'category': 'Point of Sale',
'depends': ['point_of_sale'],
'assets': {
'point_of_sale.assets': [
'/test_app/static/src/js/receipt_screen.js',
'/test_app/static/src/xml/receipt_screen.xml',
],
},
'installable': True,
'license': 'LGPL-3',
}
receipt_screen.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-inherit="point_of_sale.ReceiptScreen" t-inherit-mode="extension">
<xpath expr="//div[contains(@class, 'receipt-options')]//div[contains(@class, 'd-flex gap-1')][1]" position="inside">
<button class="button print btn btn-lg btn-secondary w-100 py-3" t-on-click="onCustomButton">
<i class="fa fa-upload me-1"/>
Send
</button>
</xpath>
</t>
</templates>
receipt_screen.js
/** @odoo-module **/
import { ReceiptScreen } from "@point_of_sale/app/screens/receipt_screen/receipt_screen";
import { patch } from "@web/core/utils/patch";
patch(ReceiptScreen.prototype, {
async onCustomButton() {
console.log("Button clicked");
}
});
The module installs without errors, but the button doesn't show up in the POS Receipt Screen. I've checked the browser's console and network tabs, and I don't see any errors.
What am I missing? Why isn't the button showing up? I've tried different xpath expressions but none seem to work. The module is properly installed and I can see it in the installed modules list.
Any help would be greatly appreciated!