diff --git a/pos_access_right_hr/__manifest__.py b/pos_access_right_hr/__manifest__.py index 53cad9416..5a8a7c35a 100644 --- a/pos_access_right_hr/__manifest__.py +++ b/pos_access_right_hr/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'POS Access Right', - 'version': '15.0.1.0.0', + 'version': '15.0.1.0.1', "category": 'Point of Sale', 'summary': 'To Restrict POS features for cashiers', 'description': 'This app allows you to enable or disable POS features ' @@ -39,6 +39,7 @@ 'pos_access_right_hr/static/src/js/models.js', 'pos_access_right_hr/static/src/js/NumpadWidget.js', 'pos_access_right_hr/static/src/js/ActionpadWidget.js', + 'pos_access_right_hr/static/src/js/product_screen.js', ], 'web.assets_qweb': [ 'pos_access_right_hr/static/src/xml/NumpadWidget.xml', diff --git a/pos_access_right_hr/doc/RELEASE_NOTES.md b/pos_access_right_hr/doc/RELEASE_NOTES.md index 8802d8ce3..dd80d3a6a 100644 --- a/pos_access_right_hr/doc/RELEASE_NOTES.md +++ b/pos_access_right_hr/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 15.0.1.0.0 ##### ADD - Initial commit for POS Access Right + +#### 10.09.2025 +#### Version 15.0.1.0.1 +##### UPDT +- Updated the module restricting the keyboard input events. diff --git a/pos_access_right_hr/static/src/js/models.js b/pos_access_right_hr/static/src/js/models.js index e43abd727..04a8ee6a3 100644 --- a/pos_access_right_hr/static/src/js/models.js +++ b/pos_access_right_hr/static/src/js/models.js @@ -1,6 +1,5 @@ odoo.define('pos_access_right_hr.models', function(require) { 'use strict'; - var models = require('point_of_sale.models'); /** To load fields from hr.employee into pos diff --git a/pos_access_right_hr/static/src/js/product_screen.js b/pos_access_right_hr/static/src/js/product_screen.js new file mode 100644 index 000000000..67a7b8cc9 --- /dev/null +++ b/pos_access_right_hr/static/src/js/product_screen.js @@ -0,0 +1,34 @@ +odoo.define('pos_access_right_hr.ProductScreen', function (require) { + 'use strict'; + + const ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + + const PosAccessRightHrProductScreen = (ProductScreen) => + class extends ProductScreen { + constructor() { + super(...arguments); + } + + async _updateSelectedOrderline(event) { + const user = this.env.pos.get_cashier() + if ((event.detail.key === "Backspace" || event.detail.key === "Delete" ) && user.disable_remove_button){ + return; + } + if (/^[0-9]$/.test(event.detail.key) && user?.disable_numpad) { + return; + } + else if (event.detail.key === '-' && user?.disable_plus_minus) { + return; // Block + key + } + else if (event.detail.key === '+' && user?.disable_plus_minus) { + return; // Block + key + } + return super._updateSelectedOrderline(...arguments); + } + + }; + + Registries.Component.extend(ProductScreen, PosAccessRightHrProductScreen); + return ProductScreen; +});