Odoo 16 Development Book

Custom Javascript Files in POS

Point of Sale use a wide range of assets. The loading of assets in Point of Sale assets in Version 15 has undergone significant changes. Let's check how we may do this.

1. Here is the module structure for adding a custom Javascript file to POS,

odoo Development

2. During the start of the POS session, define the console.

odoo.define('custom_pos.pos', function (require) {
"use strict";
   console.log("Custom JavaScript In POS")
});

3.JavaScript asset registration at the point of sale:

'assets': {
   'point_of_sale.assets': [
       'custom_pos_javascript_file/static/src/js/**/*',
   ],
},

Enter the custom_pos_javascript_file module. Start a new session from the point of sale area to see the changes in action.

How it works

Including javascript in the module. Create a console log. To view the message, you need to open the developer tools in your browser. The following log can be seen on the console tab. This shows that your javascript file was successfully uploaded.

odoo Development
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message