Update production_planning_tool.py

This commit is contained in:
Nabin Hait 2013-05-31 14:00:07 +05:30
parent 74a62b17f4
commit 4631abfb71

View File

@ -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")
webnotes.msgprint("Nothing to request")