From 2c95ab3897571bdfa63e62d0c7ac73dd91db50c6 Mon Sep 17 00:00:00 2001 From: Jay Parikh Date: Thu, 1 Feb 2018 22:52:58 -0800 Subject: [PATCH] Code fix for Enable/Disable Discount in POS using POS Profile #11748 --- .../page/point_of_sale/point_of_sale.js | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 70e45f9512..bc7ebf3abe 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -464,7 +464,7 @@ erpnext.pos.PointOfSale = class PointOfSale { if (r.message) { this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice'; this.frm.allow_edit_rate = r.message.allow_edit_rate; - this.frm.allow_edit_discount = r.message.allow_edit_discount; + this.frm.allow_edit_discount = r.message.allow_edit_discount; } } @@ -585,6 +585,7 @@ class POSCart { this.numpad && this.numpad.reset_value(); this.customer_field.set_value(""); + this.$discount_amount.find('input:text').val(''); this.wrapper.find('.grand-total-value').text( format_currency(this.frm.doc.grand_total, this.frm.currency)); this.wrapper.find('.rounded-total-value').text( @@ -715,19 +716,15 @@ class POSCart { this.customer_field.set_value(this.frm.doc.customer); } - disable_numpad_control() { - if(!this.frm.allow_edit_rate && !this.frm.allow_edit_discount) { - return ['Rate', 'Disc']; + disable_numpad_control() { + let disabled_btns = []; + if(!this.frm.allow_edit_rate) { + disabled_btns.push('Rate'); } - if(!this.frm.allow_edit_rate || !this.frm.allow_edit_discount) { - if(!this.frm.allow_edit_rate) { - return ['Rate']; - } else { - return ['Disc']; - } - } else { - return []; + if(!this.frm.allow_edit_discount) { + disabled_btns.push('Disc'); } + return disabled_btns; } make_numpad() {