fix: ordered_qty for production-plan-item
(cherry picked from commit 4e58c1da3ac1649d64377d53aec68e489a4a9d41)
This commit is contained in:
parent
551f2967da
commit
360a06b9ba
@ -449,7 +449,13 @@ class WorkOrder(Document):
|
|||||||
|
|
||||||
def update_ordered_qty(self):
|
def update_ordered_qty(self):
|
||||||
if self.production_plan and self.production_plan_item:
|
if self.production_plan and self.production_plan_item:
|
||||||
qty = self.qty if self.docstatus == 1 else 0
|
qty = frappe.get_value("Production Plan Item", self.production_plan_item, "ordered_qty")
|
||||||
|
|
||||||
|
if self.docstatus == 1:
|
||||||
|
qty += self.qty
|
||||||
|
elif self.docstatus == 2:
|
||||||
|
qty -= self.qty
|
||||||
|
|
||||||
frappe.db.set_value('Production Plan Item',
|
frappe.db.set_value('Production Plan Item',
|
||||||
self.production_plan_item, 'ordered_qty', qty)
|
self.production_plan_item, 'ordered_qty', qty)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user