Merge branch 'develop' into production-planning-status-filter
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.json b/erpnext/manufacturing/doctype/production_plan/production_plan.json
index 850d5ae..7daf706 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.json
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.json
@@ -19,6 +19,7 @@
"column_break2",
"from_date",
"to_date",
+ "sales_order_status",
"sales_orders_detail",
"get_sales_orders",
"sales_orders",
@@ -301,13 +302,20 @@
"label": "Warehouses",
"options": "Production Plan Material Request Warehouse",
"read_only": 1
+ },
+ {
+ "depends_on": "eval: doc.get_items_from == \"Sales Order\"",
+ "fieldname": "sales_order_status",
+ "fieldtype": "Select",
+ "label": "Sales Order Status",
+ "options": "\nTo Deliver and Bill\nTo Bill\nTo Deliver"
}
],
"icon": "fa fa-calendar",
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
- "modified": "2020-10-26 13:00:54.335319",
+ "modified": "2020-11-10 18:01:54.991970",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan",
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index a314a15..3833e86 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -571,6 +571,8 @@
so_filter += " and so.customer = %(customer)s"
if self.project:
so_filter += " and so.project = %(project)s"
+ if self.sales_order_status:
+ so_filter += "and so.status = %(sales_order_status)s"
if self.item_code:
item_filter += " and so_item.item_code = %(item)s"
@@ -594,8 +596,8 @@
"customer": self.customer,
"project": self.project,
"item": self.item_code,
- "company": self.company
-
+ "company": self.company,
+ "sales_order_status": self.sales_order_status
}, as_dict=1)
return open_so
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index fa9d080..27335aa 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -137,7 +137,8 @@
'from_date': so.transaction_date,
'to_date': so.transaction_date,
'customer': so.customer,
- 'item_code': item
+ 'item_code': item,
+ 'sales_order_status': so.status
})
sales_orders = get_sales_orders(pln) or {}
sales_orders = [d.get('name') for d in sales_orders if d.get('name') == sales_order]