1

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!

1 Answer 1

0

This worked for me

'assets': {

    'point_of_sale._assets_pos': [
        'your_module_name/static/src/xml/*.xml',
        'your_module_name/static/src/js/*.js',
    ],

},

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.