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/.
| Screen | Files |
|---|---|
| Product Screen | product_screen/product_screen.{js,xml,scss} |
| Partner List Screen | partner_list/partner_list.* on Odoo 20, partner_list_screen/partner_list_screen.* on 18 and 19 |
| Payment Screen | payment_screen/payment_screen.* |
| Receipt Screen | On 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 Screen | ticket_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.
| Screen | Patched on Odoo 20 | Sample added on Odoo 20 |
|---|---|---|
| Product Screen | ProductScreen: setup and addProductToOrder | A Custom button inside the subpads container, which shows a notification. |
| Partner List Screen | PartnerList (a dialog on Odoo 20): setup and clickPartner | A Custom Action button in the dialog footer. |
| Payment Screen | PaymentScreen: setup, addNewPaymentLine and onClickValidate | A Custom Action button with the payment buttons. |
| Receipt Screen | GeneratePrinterData: generateReceiptData | A message added to the receipt data, shown in the receipt footer by the extended pos_order_receipt_footer template. |
| Order Management Screen | TicketScreen: setup and onDeleteOrder | An 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
- Right-click your module folder in the Explorer.
- Select Assista Odoo > POS Components > Extend Screen.
- 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
supercalls unless you mean to replace the original behaviour.
Next steps
- OWL components
- Odoo JavaScript reference, which covers the Point of Sale app