V16
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
Hi,
1. In the XML Template, we have to inherit the point_of_sale.PaymentScreen, after inheriting the template, we can add the buttons
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-inherit="point_of_sale.
<xpath expr="//div[hasclass('payment-
<div>
<div id="my_button" class="button js_invoice"
t-on-click="IsCustomButton">
<i class="fa fa-spinner fa-spin"/> Click me
</div>
</div>
</xpath>
</t>
</templates>
2. In the JS
odoo.define('pos_button.CustomButtonPaymentScreen', function(require) {
'use strict';
const { Gui } = require('point_of_sale.Gui');
const PosComponent = require('point_of_sale.PosComponent');
const { identifyError } = require('point_of_sale.utils');
const ProductScreen = require('point_of_sale.ProductScreen');
const { useListener } = require("@web/core/utils/hooks");
const Registries = require('point_of_sale.Registries');
const PaymentScreen = require('point_of_sale.PaymentScreen');
const Chrome = require('point_of_sale.Chrome');
const CustomButtonPaymentScreen = (PaymentScreen) =>
class extends PaymentScreen {
setup() {
super.setup();
useListener('click', this.IsCustomButton);
}
IsCustomButton() {
// click_invoice
Gui.showPopup("ConfirmPopup", {
title: this.env._t('Title'),
body: this.env._t('Welcome to OWL(body of popup)'),
});
}
};
Registries.Component.extend(PaymentScreen, CustomButtonPaymentScreen);
return CustomButtonPaymentScreen;
});
For more information, refer to the blog:
https://www.cybrosys.com/blog/how-to-add-a-custom-button-in-the-pos-screen-odoo-16#:~:text=To%20add%20a%20button%20in,Systray%20and%20payment%20screen.
Hope it helps
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Inscribirse