From bc4574b59d7f13f6ecb1d797d37fe5aa647751b5 Mon Sep 17 00:00:00 2001 From: Anurag mishra Date: Thu, 22 Nov 2018 18:12:45 +0530 Subject: [PATCH] Delivery Note fixes --- erpnext/stock/doctype/delivery_note/delivery_note.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index ab624d17db..e4cfb474ff 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -119,6 +119,12 @@ class DeliveryNote(SellingController): self.update_current_stock() if not self.installation_status: self.installation_status = 'Not Installed' + + def validate_qty(self): + data = frappe.get_all("Delivery Note Item", filters={"parent" : self.name}, fields=["qty"]) + for quant in data: + if quant.qty == 0: + frappe.throw("Item quantity can not be zero") def validate_with_previous_doc(self): super(DeliveryNote, self).validate_with_previous_doc({ @@ -202,6 +208,7 @@ class DeliveryNote(SellingController): def on_submit(self): self.validate_packed_qty() + self.validate_qty() # Check for Approving Authority frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)