Chapter 17 - Odoo 15 Development Book

Custom Javascript Files in PoS

Point of Sale uses a wide range of assets. Such as managing javascript files, scss files etc. Here we want to add custom javascript files to POS.

There are significant changes in loading assets in Point of Sale assets in Version 15. Let us check how we can do this,

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

    odoo-development-book

    2. Defined the console at the opening of the POS session

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

    3. Registering a javascript file at point of sale assets:

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

Enter the custom_pos_javascript_file module.To see changes in action, start a new session from the point of sale area.

How it works

Add a javascript file to the module. Add a log to the console. You will need to open the browser developer tools to view the message. On the console tab, you will see the following log. This indicates that your javascript file was uploaded successfully.

odoo-development-book
whatsapp
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