Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
197 Переглядів

Hello everyone, I am trying to add a custom button in POS, but it is not working, even when I do the same thing I see in forums or videos. Odoo doesn't show anything in the view or in the log. 


I even see this in forums for the manifest:


‘assets’: {'point_of_sale. _assets_pos': [...]}


but it doesn't work for me, it gives me an error. It only doesn't give an error if I do it like this: 


‘assets’: {‘point_of_sale.assets’: [...]}


but it still doesn't show the button.



I need the button to appear next to the button labeled “Cliente”. Can someone explain to me what's going on?

Аватар
Відмінити
Найкраща відповідь

To add a custom button in Odoo POS, ensure you follow these steps:



  Check your module's manifest file to ensure the assets are correctly defined as ‘point_of_sale.assets’.

  Verify that your JavaScript file is correctly included in the assets and that it contains the logic to add the button.

  Ensure your JavaScript code is correctly targeting the POS view and that there are no syntax errors preventing execution.


If you’d like to explore this further for your use case, you’re welcome to connect with us at Pragmatic Techsoft.

Аватар
Відмінити
Найкраща відповідь

Hi,


Please take a look at the following for adding a button in the pos screen.


* https://www.cybrosys.com/blog/how-to-add-a-custom-button-in-odoo-17-pos-screen


* https://www.cybrosys.com/blog/how-to-add-a-custom-button-in-odoo-18-pos-screen#:~:text=Odoo's%20POS%20system%20utilizes%20XML,structure%20of%20your%20custom%20button.


* https://www.cybrosys.com/blog/how-to-create-modify-component-control-buttons-in-pos-odoo-18


Solved forum

* https://www.odoo.com/es/forum/ayuda-1/how-to-add-button-in-paymentscreen-payment-ui-267143


Hope it helps

Аватар
Відмінити
Автор

I try, but its not work. this is my code

manifest:

{
'name': "Fiscal POS (Dominican Republic)",
'summary':
"""
This module adds NCF invoicing functionalities to the POS.
""",
'license': 'LGPL-3',
'website': "https://github.com/odoo-dominicana",
'category': 'Localization',
'version': '18.0.0.0.3',
'depends': [
'base',
'point_of_sale',
'l10n_do_accounting',
],
'data': [
],
'assets': {
'point_of_sale.assets': [
'l10n_do_pos/static/src/**/*',
'l10n_do_pos/static/src/**/*',
],
},
'installable': True,
}

payment_screen_extend.xml:

<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="l10n_do_pos.PaymentScreenButtons" t-inherit="point_of_sale.PaymentScreenButtons" t-inherit-mode="extension">
<xpath expr="//div[hasclass('ppayment-buttons')]" position="inside">
<button class="btn btn-light btn-lg d-flex justify-content-between align-items-baseline w-100 w-md-50 lh-lg" t-on-click="onClickTest">
<span>
<i class="fa fa-file-text-o me-2"></i>Test Button
</span>
</button>
</xpath>
</t>
</templates>

payment_screen_extend.js:

/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";

patch(PaymentScreen.prototype, {
async onClickTest() {
console.log("Clicked Test Button");
},
});

I can't see the problem.

Related Posts Відповіді Переглядів Дія
3
жовт. 21
7384
2
бер. 20
7346
2
трав. 18
7409
8
трав. 24
19643
1
квіт. 17
4443