From 517b716444a813cb81930ecc7abb645ae813387d Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Wed, 6 Sep 2023 17:15:06 +0530 Subject: [PATCH] Sep 6 [FIX] : Bug Fixed 'pos_refund_password' --- pos_refund_password/__manifest__.py | 2 +- pos_refund_password/doc/RELEASE_NOTES.md | 4 ++ .../static/src/js/refund_password.js | 38 +++++++++++++------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/pos_refund_password/__manifest__.py b/pos_refund_password/__manifest__.py index 7d5d9f362..1a91dd57d 100644 --- a/pos_refund_password/__manifest__.py +++ b/pos_refund_password/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Restrict POS Refund with Password In Odoo 16', - 'version': '16.0.1.0.1', + 'version': '16.0.1.0.2', 'summary': """Restrict POS Refund with Password In Odoo 16""", 'description': """Restrict POS Refund with Password In Odoo 16""", 'category': 'Point of Sale', diff --git a/pos_refund_password/doc/RELEASE_NOTES.md b/pos_refund_password/doc/RELEASE_NOTES.md index 4e296ac2b..a4d344ef5 100644 --- a/pos_refund_password/doc/RELEASE_NOTES.md +++ b/pos_refund_password/doc/RELEASE_NOTES.md @@ -8,3 +8,7 @@ #### Version 16.0.1.0.1 #### FIX - Fixed the undeclared body +- #### 06.09.2023 +#### Version 16.0.1.0.2 +#### FIX +- Fixed the refund password issue diff --git a/pos_refund_password/static/src/js/refund_password.js b/pos_refund_password/static/src/js/refund_password.js index bfcd8f8fc..64c25a618 100644 --- a/pos_refund_password/static/src/js/refund_password.js +++ b/pos_refund_password/static/src/js/refund_password.js @@ -11,6 +11,7 @@ odoo.define('pos_refund_password.RefundPasswordButton', function (require) { class extends TicketScreen { async _onDoRefund() { var refund=""; + var session_refund= false; var data = await rpc.query({ model: 'ir.config_parameter', method: 'get_param', @@ -23,19 +24,34 @@ odoo.define('pos_refund_password.RefundPasswordButton', function (require) { 'Incorrect Password') }; if (!refund){ - refund=this.env.pos.config.refund_security; } - const { confirmed, payload } = await this.showPopup('NumberPopup') - if(refund == payload) - { - super._onDoRefund(); + session_refund = this.env.pos.config.refund_security; + } + if(refund){ + const { confirmed, payload } = await this.showPopup('NumberPopup') + if(refund == payload){ + super._onDoRefund(); + } + else{ + this.showPopup('ErrorPopup',{ + body : this.env._t('Invalid Password, Enter your global password'), + }); + } } - else{ - this.showPopup('ErrorPopup',{ - body : this.env._t('Invalid Password'), - }); + else if(session_refund){ + const { confirmed, payload } = await this.showPopup('NumberPopup') + if(session_refund == payload){ + super._onDoRefund(); } + else{ + this.showPopup('ErrorPopup',{ + body : this.env._t('Incorrect Password'), + }); + } + } + else{ + super._onDoRefund(); + } } - }; Registries.Component.extend(TicketScreen, PosResTicketScreen1); - }); + }); \ No newline at end of file