diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 3a77e2f209..8334f6b869 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -430,7 +430,7 @@ def download_raw_materials(production_plan): continue item_list.append(['', '', '', '', bin_dict.get('warehouse'), - bin_dict.get('projected_qty'), bin_dict.get('actual_qty')]) + bin_dict.get('projected_qty', 0), bin_dict.get('actual_qty', 0)]) build_csv_response(item_list, doc.name) @@ -507,8 +507,8 @@ def get_material_request_items(row, sales_order, required_qty = 0 if ignore_existing_ordered_qty or bin_dict.get("projected_qty", 0) < 0: required_qty = total_qty - elif total_qty > bin_dict.get("projected_qty"): - required_qty = total_qty - bin_dict.get("projected_qty") + elif total_qty > bin_dict.get("projected_qty", 0): + required_qty = total_qty - bin_dict.get("projected_qty", 0) if required_qty > 0 and required_qty < row['min_order_qty']: required_qty = row['min_order_qty'] item_group_defaults = get_item_group_defaults(row.item_code, company)