From 0ef01fc2059d0786b650f06825b5cefd46beb6af Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Mon, 8 Jan 2024 14:43:24 +0530 Subject: [PATCH] Jan 8 [UPDT] : Updated 'pos_access_right_hr' --- pos_access_right_hr/__init__.py | 2 +- pos_access_right_hr/__manifest__.py | 5 ++-- pos_access_right_hr/doc/RELEASE_NOTES.md | 7 ++++- pos_access_right_hr/models/__init__.py | 2 +- pos_access_right_hr/models/hr_employee.py | 2 +- pos_access_right_hr/models/pos_session.py | 2 +- .../static/src/js/ProductScreenAccessRight.js | 30 +++++++++++++++++++ 7 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 pos_access_right_hr/static/src/js/ProductScreenAccessRight.js diff --git a/pos_access_right_hr/__init__.py b/pos_access_right_hr/__init__.py index 79ffb9885..d41dfed5b 100644 --- a/pos_access_right_hr/__init__.py +++ b/pos_access_right_hr/__init__.py @@ -4,7 +4,7 @@ # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Cybrosys Techno Solutions() +# Author: Viswanth k (odoo@cybrosys.com) # # You can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. diff --git a/pos_access_right_hr/__manifest__.py b/pos_access_right_hr/__manifest__.py index f12d4e0a2..7a224fb3f 100644 --- a/pos_access_right_hr/__manifest__.py +++ b/pos_access_right_hr/__manifest__.py @@ -4,7 +4,7 @@ # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Cybrosys Techno Solutions() +# Author: Viswanth k (odoo@cybrosys.com) # # You can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. @@ -40,7 +40,8 @@ 'pos_access_right_hr/static/src/js/NumpadWidgetAccessRight.js', 'pos_access_right_hr/static/src/js/ActionpadWidgetAccessRight.js', 'pos_access_right_hr/static/src/xml/NumpadWidgetAccessRight.xml', - 'pos_access_right_hr/static/src/xml/ActionpadWidgetAccessRight.xml' + 'pos_access_right_hr/static/src/xml/ActionpadWidgetAccessRight.xml', + 'pos_access_right_hr/static/src/js/ProductScreenAccessRight.js' ], }, 'images': ['static/description/banner.png'], diff --git a/pos_access_right_hr/doc/RELEASE_NOTES.md b/pos_access_right_hr/doc/RELEASE_NOTES.md index 1a13edb06..9177e2579 100644 --- a/pos_access_right_hr/doc/RELEASE_NOTES.md +++ b/pos_access_right_hr/doc/RELEASE_NOTES.md @@ -3,4 +3,9 @@ #### 04.05.2023 #### Version 16.0.1.0.0 ##### ADD -- Initial commit for POS Access Right \ No newline at end of file +- Initial commit for POS Access Right + +#### 02.01.2024 +#### Version 16.0.1.0.1 +##### FIX +- Fix the keyboard event handling issue diff --git a/pos_access_right_hr/models/__init__.py b/pos_access_right_hr/models/__init__.py index f5ef4abb0..21e168620 100644 --- a/pos_access_right_hr/models/__init__.py +++ b/pos_access_right_hr/models/__init__.py @@ -4,7 +4,7 @@ # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Cybrosys Techno Solutions() +# Author: Viswanth k (odoo@cybrosys.com) # # You can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. diff --git a/pos_access_right_hr/models/hr_employee.py b/pos_access_right_hr/models/hr_employee.py index 612d1d2e5..6f283d682 100644 --- a/pos_access_right_hr/models/hr_employee.py +++ b/pos_access_right_hr/models/hr_employee.py @@ -4,7 +4,7 @@ # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Cybrosys Techno Solutions() +# Author: Viswanth k (odoo@cybrosys.com) # # You can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. diff --git a/pos_access_right_hr/models/pos_session.py b/pos_access_right_hr/models/pos_session.py index 77881ecac..4c876fabd 100644 --- a/pos_access_right_hr/models/pos_session.py +++ b/pos_access_right_hr/models/pos_session.py @@ -4,7 +4,7 @@ # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2023-TODAY Cybrosys Technologies() -# Author: Cybrosys Techno Solutions() +# Author: Viswanth k (odoo@cybrosys.com) # # You can modify it under the terms of the GNU LESSER # GENERAL PUBLIC LICENSE (LGPL v3), Version 3. diff --git a/pos_access_right_hr/static/src/js/ProductScreenAccessRight.js b/pos_access_right_hr/static/src/js/ProductScreenAccessRight.js new file mode 100644 index 000000000..89588861e --- /dev/null +++ b/pos_access_right_hr/static/src/js/ProductScreenAccessRight.js @@ -0,0 +1,30 @@ +odoo.define('pos_access_right_hr.ProductScreenAccessRight', function(require) { + 'use strict'; + const ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + const ProductScreenAccessRight= (ProductScreen) => class extends ProductScreen{ + /** + * method to check the access of the cashier to use Delete and Backspace in ProductScreen + */ + check_remove_access() { + if (this.env.pos.config.module_pos_hr) { + const cashierId = this.env.pos.get_cashier().id; + const sessionAccess = this.env.pos.session_access.find(access => access.id === cashierId); + return sessionAccess ? sessionAccess.disable_remove_button : false; + } else { + return false; + } + } + /** + * Override the method for disabling the usage of Delete and Backspace keys based on the access set for the cashier + */ + async _updateSelectedOrderline(event) { + if ((event.detail.key === "Backspace" || event.detail.key === "Delete" ) && this.check_remove_access()){ + return; + } + return super._updateSelectedOrderline(...arguments); + } + } + Registries.Component.extend(ProductScreen, ProductScreenAccessRight); + return ProductScreen; +});