From 0cd5313c69c7af362cbd1c422411c41970041ef0 Mon Sep 17 00:00:00 2001 From: KanchanChauhan Date: Thu, 30 Aug 2018 19:11:15 +0530 Subject: [PATCH] Validate Completed Qty and Produced qty in Stock Entry for Manufacture (#15248) --- erpnext/stock/doctype/stock_entry/stock_entry.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index cd0255e0cc..f723fcf359 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -58,6 +58,7 @@ class StockEntry(StockController): self.validate_with_material_request() self.validate_batch() self.validate_inspection() + self.validate_fg_completed_qty() if not self.from_bom: self.fg_completed_qty = 0.0 @@ -186,6 +187,13 @@ class StockEntry(StockController): if stock_qty > trans_qty: item_code.append(item.item_code) + def validate_fg_completed_qty(self): + if self.purpose == "Manufacture" and self.work_order: + production_item = frappe.get_value('Work Order', self.work_order, 'production_item') + for item in self.items: + if item.item_code == production_item and item.qty != self.fg_completed_qty: + frappe.throw(_("Finished product quantity {0} and For Quantity {1} cannot be different").format(item.qty, self.fg_completed_qty)) + def validate_warehouse(self): """perform various (sometimes conditional) validations on warehouse"""