Reputation: 11
I'm trying to add a custom button to the Odoo 18 POS interface using a custom module. I've followed the documentation and tried all possible ways, but the button is not showing up. The module is loading correctly, and there are no errors in the console. Here's my code:
complaint.xml xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="pos_custom.ControlButtons" t-inherit="point_of_sale.ControlButtons" t-inherit-mode="extension">
<xpath expr="//div[@class='control-buttons']" position="inside">
<button class="btn btn-light btn-lg flex-shrink-0 ms-auto" t-on-click="onClickPopupSingleField">
Custom Button
</button>
</xpath>
</t>
</templates>
complaint.js javascript
import { ControlButtons } from "@point_of_sale/app/screens/product_screen/control_buttons/control_buttons";
import { patch } from "@web/core/utils/patch";
patch(ControlButtons.prototype, {
onClickPopupSingleField() {
alert("Custom Button Clicked!");
}
});
manifest.py python
{
'name': 'POS Complaint',
'version': '1.0',
'category': 'Point of Sale',
'summary': 'Add a Create Complaint button in POS Partner List',
'depends': ['point_of_sale'],
'assets': {
'point_of_sale.assets': [
'pos_complaint/static/src/js/complaint.js',
'pos_complaint/static/src/xml/complaint.xml',
],
},
'installable': True,
'application': True,
}
Directory Structure
pos_complaint/
├── __init__.py
├── __manifest__.py
├── static/
│ └── src/
│ ├── js/
│ │ └── complaint.js
│ └── xml/
│ └── complaint.xml
What I've Tried:
Rebuilt assets using --dev=all.
Cleared browser cache.
Verified that the module is installed correctly.
Checked the browser console for errors (no errors found).
The custom button should appear in the POS interface.
Odoo Version: 18 Python Version: 3.10
Can anyone help me figure out why the button is not showing up? Thanks in advance!
Upvotes: 1
Views: 42