From 6f6d5cb4cffebefa8754b62ec0264c4aadc97cda Mon Sep 17 00:00:00 2001 From: Niraj Gautam Date: Sun, 12 Nov 2023 11:52:35 +0530 Subject: [PATCH] fix(POS): 100 % Discount on Point of Sales (#37411) fix: Allow 100% discount in POS --- erpnext/selling/page/point_of_sale/pos_controller.js | 8 ++++++++ erpnext/selling/page/point_of_sale/pos_payment.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/page/point_of_sale/pos_controller.js b/erpnext/selling/page/point_of_sale/pos_controller.js index db6255a4bee4..9bba4ebf505f 100644 --- a/erpnext/selling/page/point_of_sale/pos_controller.js +++ b/erpnext/selling/page/point_of_sale/pos_controller.js @@ -548,6 +548,14 @@ erpnext.PointOfSale.Controller = class { if (!item_code) return; + if (rate == undefined || rate == 0) { + frappe.show_alert({ + message: __('Price is not set for the item.'), + indicator: 'orange' + }); + frappe.utils.play_sound("error"); + return; + } const new_item = { item_code, batch_no, rate, uom, [field]: value }; if (serial_no) { diff --git a/erpnext/selling/page/point_of_sale/pos_payment.js b/erpnext/selling/page/point_of_sale/pos_payment.js index 89ce61ab1680..63711c5ed29d 100644 --- a/erpnext/selling/page/point_of_sale/pos_payment.js +++ b/erpnext/selling/page/point_of_sale/pos_payment.js @@ -203,7 +203,7 @@ erpnext.PointOfSale.Payment = class { const paid_amount = doc.paid_amount; const items = doc.items; - if (paid_amount == 0 || !items.length) { + if (!items.length || (paid_amount == 0 && doc.additional_discount_percentage != 100)) { const message = items.length ? __("You cannot submit the order without payment.") : __("You cannot submit empty order."); frappe.show_alert({ message, indicator: "orange" }); frappe.utils.play_sound("error");