Validate Completed Qty and Produced qty in Stock Entry for Manufacture (#15248)

This commit is contained in:
KanchanChauhan 2018-08-30 19:11:15 +05:30 committed by Nabin Hait
parent 9983d41fb0
commit 0cd5313c69

View File

@ -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 <b>{0}</b> and For Quantity <b>{1}</b> cannot be different").format(item.qty, self.fg_completed_qty))
def validate_warehouse(self):
"""perform various (sometimes conditional) validations on warehouse"""