Skip to content

POS screen extension ​

Extend a Point of Sale screen with patch() and template inheritance. The extension writes the JavaScript, template and SCSS files, adds them to point_of_sale._assets_pos and adds point_of_sale to the manifest depends.

What you can do ​

Files are created under static/src/app/screens/.

ScreenFiles
Product Screenproduct_screen/product_screen.{js,xml,scss}
Partner List Screenpartner_list/partner_list.* on Odoo 20, partner_list_screen/partner_list_screen.* on 18 and 19
Payment Screenpayment_screen/payment_screen.*
Receipt ScreenOn Odoo 20, receipt/generate_printer_data.js (patches the receipt data) and views/pos_order_receipt.xml (extends the point_of_sale.pos_order_receipt_footer template). On 18 and 19, receipt_screen/receipt_screen.*
Order Management Screenticket_screen/ticket_screen.*

On Odoo 20, the receipt template goes in the manifest data list. All other files go in the point_of_sale._assets_pos bundle.

What each screen includes ​

Each screen file patches the screen's class with patch() and calls super so the original behaviour is kept. Each also extends the screen's template with a sample element, such as a button, with a handler you can replace. The samples below are for Odoo 20. Odoo 18 and 19 generate different sample buttons and handlers.

ScreenPatched on Odoo 20Sample added on Odoo 20
Product ScreenProductScreen: setup and addProductToOrderA Custom button inside the subpads container, which shows a notification.
Partner List ScreenPartnerList (a dialog on Odoo 20): setup and clickPartnerA Custom Action button in the dialog footer.
Payment ScreenPaymentScreen: setup, addNewPaymentLine and onClickValidateA Custom Action button with the payment buttons.
Receipt ScreenGeneratePrinterData: generateReceiptDataA message added to the receipt data, shown in the receipt footer by the extended pos_order_receipt_footer template.
Order Management ScreenTicketScreen: setup and onDeleteOrderAn Order Info button that shows the selected order.

Example of a patch on Odoo 20:

js
import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen";
import { patch } from "@web/core/utils/patch";

patch(ProductScreen.prototype, {
    async addProductToOrder(product) {
        // Custom logic before a product is added
        const result = await super.addProductToOrder(...arguments);
        // Custom logic after
        return result;
    },
});

Get started ​

  1. Right-click your module folder in the Explorer.
  2. Select Assista Odoo > POS Components > Extend Screen.
  3. Choose the screen to extend.

Tips and limits ​

  • Check the Odoo version in the status bar first. The receipt and partner list files differ between 18/19 and 20.
  • You do not enter a name. Each screen uses a fixed folder, so a second run for the same screen reports that the folder already exists and creates nothing.
  • The style classes of the sample buttons start with your module name, so they do not clash with other modules.
  • Replace the sample buttons and handlers with your own logic. Keep the super calls unless you mean to replace the original behaviour.

Next steps ​

Built by Cybrosys Technologies.