diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 1686478f64..d4e41aca5f 100644 --- a/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -317,9 +317,9 @@ class DocType: items_to_be_requested = webnotes._dict() for item in self.item_dict: - if flt(self.item_dict[item][0]) > item_projected_qty[item]: + if flt(self.item_dict[item][0]) > item_projected_qty.get(item, 0): # shortage - requested_qty = flt(self.item_dict[item][0]) - item_projected_qty[item] + requested_qty = flt(self.item_dict[item][0]) - item_projected_qty.get(item, 0) # comsider minimum order qty requested_qty = requested_qty > flt(self.item_dict[item][3]) and \ requested_qty or flt(self.item_dict[item][3]) @@ -379,4 +379,4 @@ class DocType: webnotes.msgprint("Following Material Request created successfully: \n%s" % "\n".join(pur_req)) else: - webnotes.msgprint("Nothing to request") \ No newline at end of file + webnotes.msgprint("Nothing to request")