Merge pull request #12816 from mntechnique/hotfix-for-#12810
Does not allow discount over 100% in POS
This commit is contained in:
commit
f1fa338999
@ -1177,8 +1177,17 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
$(this.wrapper).on("change", ".pos-item-disc", function () {
|
||||
var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code");
|
||||
var discount = $(this).val();
|
||||
me.update_discount(item_code, discount)
|
||||
me.update_value()
|
||||
if(discount > 100){
|
||||
discount = $(this).val('');
|
||||
frappe.show_alert({
|
||||
indicator: 'red',
|
||||
message: __('Discount amount cannot be greater than 100%')
|
||||
});
|
||||
me.update_discount(item_code, discount);
|
||||
}else{
|
||||
me.update_discount(item_code, discount);
|
||||
me.update_value();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -768,11 +768,19 @@ class POSCart {
|
||||
return;
|
||||
}
|
||||
|
||||
const item_code = this.selected_item.attr('data-item-code');
|
||||
const field = this.selected_item.active_field;
|
||||
const value = this.numpad.get_value();
|
||||
if (this.selected_item.active_field == 'discount_percentage' && this.numpad.get_value() > cint(100)) {
|
||||
frappe.show_alert({
|
||||
indicator: 'red',
|
||||
message: __('Discount amount cannot be greater than 100%')
|
||||
});
|
||||
this.numpad.reset_value();
|
||||
} else {
|
||||
const item_code = this.selected_item.attr('data-item-code');
|
||||
const field = this.selected_item.active_field;
|
||||
const value = this.numpad.get_value();
|
||||
|
||||
this.events.on_field_change(item_code, field, value);
|
||||
this.events.on_field_change(item_code, field, value);
|
||||
}
|
||||
}
|
||||
|
||||
this.events.on_numpad(btn_value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user