mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 07:01:56 +00:00
fix: reinstate mandatory manufactured qty check for manufacture entries
This commit is contained in:
@@ -25,6 +25,10 @@ class DuplicateEntryForWorkOrderError(frappe.ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
class ManufacturedQtyMandatoryError(frappe.ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
class OperationsNotCompleteError(frappe.ValidationError):
|
||||
pass
|
||||
|
||||
@@ -282,6 +286,7 @@ class ManufactureStockEntry(BaseManufactureStockEntry):
|
||||
def validate(self):
|
||||
self.validate_warehouse()
|
||||
self.validate_raw_materials_exists()
|
||||
self.validate_manufactured_qty()
|
||||
self.check_if_operations_completed()
|
||||
self.check_duplicate_entry_for_work_order()
|
||||
self.validate_component_and_quantities()
|
||||
@@ -391,6 +396,14 @@ class ManufactureStockEntry(BaseManufactureStockEntry):
|
||||
if not self.doc.work_order:
|
||||
frappe.throw(_("Work Order is mandatory"))
|
||||
|
||||
def validate_manufactured_qty(self):
|
||||
"""Without fg_completed_qty, submit never updates or validates the work order's produced qty."""
|
||||
if not self.wo_doc or self.wo_doc.track_semi_finished_goods:
|
||||
return
|
||||
|
||||
if not self.doc.fg_completed_qty:
|
||||
frappe.throw(_("For Quantity (Manufactured Qty) is mandatory"), ManufacturedQtyMandatoryError)
|
||||
|
||||
def check_if_operations_completed(self):
|
||||
"""Require operation (job card) completion before manufacture, so operating costs are captured."""
|
||||
if not self.wo_doc or self.wo_doc.track_semi_finished_goods:
|
||||
@@ -950,6 +963,7 @@ class MaterialConsumptionForManufactureStockEntry(ManufactureStockEntry):
|
||||
|
||||
def validate(self):
|
||||
self.validate_work_order()
|
||||
self.validate_manufactured_qty()
|
||||
self.check_if_operations_completed()
|
||||
|
||||
def add_items(self):
|
||||
|
||||
@@ -39,6 +39,7 @@ from erpnext.stock.utils import get_incoming_rate
|
||||
from .services.disassemble import DisassembleStockEntry
|
||||
from .services.manufacturing import (
|
||||
DuplicateEntryForWorkOrderError,
|
||||
ManufacturedQtyMandatoryError,
|
||||
ManufactureStockEntry,
|
||||
MaterialConsumptionForManufactureStockEntry,
|
||||
OperationsNotCompleteError,
|
||||
|
||||
Reference in New Issue
Block a user