mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-10 05:48:15 +00:00
fix: production plan status
This commit is contained in:
@@ -693,8 +693,8 @@ class ProductionPlan(Document):
|
||||
self.status = "Completed"
|
||||
|
||||
if self.status != "Completed":
|
||||
self.update_ordered_status()
|
||||
self.update_requested_status()
|
||||
self.update_ordered_status()
|
||||
|
||||
if close is not None:
|
||||
self.db_set("status", self.status)
|
||||
@@ -703,25 +703,17 @@ class ProductionPlan(Document):
|
||||
self.update_bin_qty()
|
||||
|
||||
def update_ordered_status(self):
|
||||
update_status = False
|
||||
for d in self.po_items:
|
||||
if d.planned_qty == d.ordered_qty:
|
||||
update_status = True
|
||||
|
||||
if update_status and self.status != "Completed":
|
||||
self.status = "In Process"
|
||||
for child_table in ["po_items", "sub_assembly_items"]:
|
||||
for item in self.get(child_table):
|
||||
if item.ordered_qty:
|
||||
self.status = "In Process"
|
||||
return
|
||||
|
||||
def update_requested_status(self):
|
||||
if not self.mr_items:
|
||||
return
|
||||
|
||||
update_status = True
|
||||
for d in self.mr_items:
|
||||
if d.quantity != d.requested_qty:
|
||||
update_status = False
|
||||
|
||||
if update_status:
|
||||
self.status = "Material Requested"
|
||||
if d.requested_qty:
|
||||
self.status = "Material Requested"
|
||||
break
|
||||
|
||||
def get_production_items(self):
|
||||
item_dict = {}
|
||||
|
||||
Reference in New Issue
Block a user