Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
75 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 10 21
7369
2
thg 3 20
7336
2
thg 5 18
7394
8
thg 5 24
19631
1
thg 4 17
4428