Browse Source

Dec 8 : [FIX] Bug Fixed 'pos_discount_manager'

pull/295/head
AjmalCybro 2 years ago
parent
commit
5f1b3e591a
  1. 7
      pos_discount_manager/doc/RELEASE_NOTES.md
  2. 2
      pos_discount_manager/static/description/index.html
  3. 45
      pos_discount_manager/static/src/js/ValidateManager.js

7
pos_discount_manager/doc/RELEASE_NOTES.md

@ -15,4 +15,9 @@
#### Version 16.0.2.0.2 #### Version 16.0.2.0.2
#### UPDATE #### UPDATE
- Manager Pin Encrypted in NumberPad. - Manager Pin Encrypted in NumberPad.
- Changed Pin Condition Check from Top Sequence Manager to Session Manager. - 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.

2
pos_discount_manager/static/description/index.html

@ -272,7 +272,7 @@
<div class="col-lg-12 my-2"> <div class="col-lg-12 my-2">
<h4 class="mt-2" <h4 class="mt-2"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;"> style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Set multiple employees per session in POS. Select the employee to whom we are giving the discount limit.</h4> Set multiple employees per session in POS. Select the employee to whom we are giving the discount limit and add other managers for validate.</h4>
<img src="assets/screenshots/pos2222.png" class="img-responsive img-thumbnail border" width="100%" <img src="assets/screenshots/pos2222.png" class="img-responsive img-thumbnail border" width="100%"
height="auto"/> height="auto"/>
</div> </div>

45
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 employee_name = this.env.pos.get_cashier()['name']
var flag = 1; var flag = 1;
orderlines.forEach((order) => { orderlines.forEach((order) => {
if(order.discount > employee_dis) if (employee_dis >= 1) {
flag = 0; if(order.discount > employee_dis)
flag = 0;
}
}); });
if (flag != 1) { if (flag != 1) {
const {confirmed,payload} = await this.showPopup('NumberPopup', { const {confirmed,payload} = await this.showPopup('NumberPopup', {
title: this.env._t(employee_name + ', your discount is over the limit. \n Manager pin for Approval'), title: this.env._t(employee_name + ', your discount is over the limit. \n Manager pin for Approval'),
isPassword: true isPassword: true
}); });
if(confirmed){ if(confirmed){
var output = this.env.pos.employees.filter((obj) => obj.role == 'manager' && obj.user_id == session.uid); var output = this.env.pos.employees.filter((obj) => obj.role == 'manager');
var pin = output[0].pin var pins = [];
if (Sha1.hash(payload) == pin) { for (var i = 0; i < output.length; i++) {
pins.push(output[i].pin);
}
if (pins.includes(Sha1.hash(payload))) {
this.showScreen(this.nextScreen); 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 { 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; return false;
} }
} }
else {
return false;
}
}
this.currentOrder.finalized = true; this.currentOrder.finalized = true;
this.showScreen(this.nextScreen); this.showScreen(this.nextScreen);
super._finalizeValidation(); super._finalizeValidation();

Loading…
Cancel
Save