diff --git a/pos_discount_manager/doc/RELEASE_NOTES.md b/pos_discount_manager/doc/RELEASE_NOTES.md index e1590cc42..da978d643 100755 --- a/pos_discount_manager/doc/RELEASE_NOTES.md +++ b/pos_discount_manager/doc/RELEASE_NOTES.md @@ -15,4 +15,9 @@ #### Version 16.0.2.0.2 #### UPDATE - Manager Pin Encrypted in NumberPad. -- Changed Pin Condition Check from Top Sequence Manager to Session Manager. \ No newline at end of file +- Changed Pin Condition Check from Top Sequence Manager to Session Manager. + +#### 08.12.2023 +#### Version 16.0.2.0.3 +#### UPDATE +- Changed Pin Condition Check from Session Manager to All Managers that are Selected in Multi Employee Section. diff --git a/pos_discount_manager/static/description/index.html b/pos_discount_manager/static/description/index.html index d3a13ecca..e19c8b66e 100755 --- a/pos_discount_manager/static/description/index.html +++ b/pos_discount_manager/static/description/index.html @@ -272,7 +272,7 @@

- Set multiple employees per session in POS. Select the employee to whom we are giving the discount limit.

+ Set multiple employees per session in POS. Select the employee to whom we are giving the discount limit and add other managers for validate.
diff --git a/pos_discount_manager/static/src/js/ValidateManager.js b/pos_discount_manager/static/src/js/ValidateManager.js index e2a40e2a5..a21bc4bb4 100755 --- a/pos_discount_manager/static/src/js/ValidateManager.js +++ b/pos_discount_manager/static/src/js/ValidateManager.js @@ -17,33 +17,38 @@ odoo.define('pos_discount_manager.ValidateManager', function(require) { var employee_name = this.env.pos.get_cashier()['name'] var flag = 1; orderlines.forEach((order) => { - if(order.discount > employee_dis) - flag = 0; + if (employee_dis >= 1) { + if(order.discount > employee_dis) + flag = 0; + } }); if (flag != 1) { - const {confirmed,payload} = await this.showPopup('NumberPopup', { - title: this.env._t(employee_name + ', your discount is over the limit. \n Manager pin for Approval'), - isPassword: true - }); - if(confirmed){ - var output = this.env.pos.employees.filter((obj) => obj.role == 'manager' && obj.user_id == session.uid); - var pin = output[0].pin - if (Sha1.hash(payload) == pin) { + const {confirmed,payload} = await this.showPopup('NumberPopup', { + title: this.env._t(employee_name + ', your discount is over the limit. \n Manager pin for Approval'), + isPassword: true + }); + if(confirmed){ + var output = this.env.pos.employees.filter((obj) => obj.role == 'manager'); + var pins = []; + for (var i = 0; i < output.length; i++) { + pins.push(output[i].pin); + } + if (pins.includes(Sha1.hash(payload))) { this.showScreen(this.nextScreen); - } - else { - this.showPopup('ErrorPopup', { - title: this.env._t(" Manager Restricted your discount"), - body: this.env._t(employee_name + ", Your Manager pin is incorrect."), - - }); - return false; - } } else { + this.showPopup('ErrorPopup', { + title: this.env._t(" Manager Restricted your discount"), + body: this.env._t(employee_name + ", Your Manager pin is incorrect."), + + }); return false; } - } + } + else { + return false; + } + } this.currentOrder.finalized = true; this.showScreen(this.nextScreen); super._finalizeValidation();