Custom javascript files
The management of assets, including custom JavaScript files, has changed significantly in Point of Sale (POS) version 17. To provide more flexibility and efficiency, the method for adding these assets to the POS system has been changed.
1. This is the module structure for customizing a Javascript file in POS.
2. Define the console at the beginning of the POS session.
/* @odoo-module */
import { registry } from "@web/core/registry";
console.log('Custom POS Receipts')
3. Registration of JavaScript assets at the point of sale:
'assets': {
'point_of_sale._assets_pos': [
'custom_pos_receipt/static/src/js/custom_pos_receipt.js',
]
},
Start the module named custom_pos_javascript_file. To observe the changes in action, start a new session from the point of sale area.
How it works
JavaScript is included in the module. Start a console log. You must open the developer tools in your browser to view the message. On the console tab, you may view the log that follows. Your JavaScript file was successfully submitted, as shown by this.