diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index d4474b657ba..06d39324589 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -145,7 +145,6 @@ class PurchaseOrder(BuyingController): and frappe.db.get_value("Item", d.item_code, "is_stock_item") \ and d.warehouse and not d.delivered_by_supplier: item_wh_list.append([d.item_code, d.warehouse]) - for item_code, warehouse in item_wh_list: update_bin_qty(item_code, warehouse, { "ordered_qty": get_ordered_qty(item_code, warehouse) diff --git a/erpnext/docs/assets/img/manufacturing/ppt.png b/erpnext/docs/assets/img/manufacturing/ppt.png index f5018b75499..30096fff836 100644 Binary files a/erpnext/docs/assets/img/manufacturing/ppt.png and b/erpnext/docs/assets/img/manufacturing/ppt.png differ diff --git a/erpnext/docs/assets/old_images/erpnext/material-request-workflow.jpg b/erpnext/docs/assets/old_images/erpnext/material-request-workflow.jpg index 6846fa5baac..c462e209f1a 100644 Binary files a/erpnext/docs/assets/old_images/erpnext/material-request-workflow.jpg and b/erpnext/docs/assets/old_images/erpnext/material-request-workflow.jpg differ diff --git a/erpnext/docs/current/models/stock/material_request_item.html b/erpnext/docs/current/models/stock/material_request_item.html new file mode 100644 index 00000000000..d1d8f6fbcab --- /dev/null +++ b/erpnext/docs/current/models/stock/material_request_item.html @@ -0,0 +1,393 @@ + + + + + + +
Table Name: tabMaterial Request Item
| Sr | +Fieldname | +Type | +Label | +Options | +
|---|---|---|---|---|
| 1 | +item_code |
+ + Link | ++ Item Code + + | ++ + + + +Item + + + + | +
| 2 | +col_break1 |
+ + Column Break | ++ + + | ++ |
| 3 | +item_name |
+ + Data | ++ Item Name + + | ++ |
| 4 | +section_break_4 |
+ + Section Break | ++ Description + + | ++ |
| 5 | +description |
+ + Text Editor | ++ Description + + | ++ |
| 6 | +column_break_6 |
+ + Column Break | ++ + + | ++ |
| 7 | +image |
+ + Attach Image | ++ Image + + | ++ |
| 8 | +quantity_and_warehouse |
+ + Section Break | ++ Quantity and Warehouse + + | ++ |
| 9 | +qty |
+ + Float | ++ Quantity + + | ++ |
| 10 | +uom |
+ + Link | ++ Stock UOM + + | ++ + + + +UOM + + + + | +
| 11 | +warehouse |
+ + Link | ++ For Warehouse + + | ++ + + + +Warehouse + + + + | +
| 12 | +col_break2 |
+ + Column Break | ++ + + | ++ |
| 13 | +schedule_date |
+ + Date | ++ Required Date + + | ++ |
| 14 | +more_info |
+ + Section Break | ++ More Information + + | ++ |
| 15 | +item_group |
+ + Link | ++ Item Group + + | ++ + + + +Item Group + + + + | +
| 16 | +brand |
+ + Link | ++ Brand + + | ++ + + + +Brand + + + + | +
| 17 | +lead_time_date |
+ + Date | ++ Lead Time Date + + | ++ |
| 18 | +sales_order |
+ + Link | ++ Sales Order + + | ++ + + + +Sales Order + + + + | +
| 19 | +col_break3 |
+ + Column Break | ++ + + | ++ |
| 20 | +min_order_qty |
+ + Float | ++ Min Order Qty + + | ++ |
| 21 | +projected_qty |
+ + Float | ++ Projected Qty + + | ++ |
| 22 | +ordered_qty |
+ + Float | ++ Completed Qty + + | ++ |
| 23 | +page_break |
+ + Check | ++ Page Break + + | ++ |
+#### Step 1: Specify source to get Production Items
+
+* You can select Sales Order or Material Request according to where you want to source the items from
+* If you plan to add items manually, keep the "Get items from" field empty
-#### Step 1: Select and get Sales Order
-* Select sales orders for MRP using filters (Time, Item, and Customer)
-* Click on Get Sales Order to generate a list.
+#### Step 2: Select and get Sales Order / Material Request
+
+* Use filters to get the Sales Order / Material Request
+* Click on Get Sales Order / Get Material Requests to generate a list.
-#### Step 2: Get Item from Sales Orders.
+#### Step 3: Get Items
-You can add/remove or change quantity of these Items.
+* Get the items for the Sales Order / Material request list
+* You can add/remove or change quantity of these Items.
-#### Step 3: Create Production Orders
+#### Step 4: Create Production Orders
-#### Step 4: Create Material Request
+#### Step 5: Create Material Request
Create Material Request for Items with projected shortfall.
@@ -46,11 +52,11 @@ Create Material Request for Items with projected shortfall.
The Production Planning Tool is used in two stages:
- * Selection of Open Sales Orders for the period based on “Expected Delivery Date”.
- * Selection of Items from those Sales Orders.
+ * Selection of open Sales Orders / pending Material Request for the period based on “Expected Delivery Date”.
+ * Selection of Items from those Sales Orders / Material Requests
-The tool will update if you have already created Production Orders for a
-particular Item against its Sales Order (“Planned Quantity”).
+The tool will update if you have already created Production Orde rs for a
+particular Item against its Sales Order (“Planned Quantity”) or Material Request.
You can always edit the Item list and increase / reduce quantities to plan
your production.
diff --git a/erpnext/docs/user/manual/en/stock/material-request.md b/erpnext/docs/user/manual/en/stock/material-request.md
index a609756d3e3..8afda601736 100644
--- a/erpnext/docs/user/manual/en/stock/material-request.md
+++ b/erpnext/docs/user/manual/en/stock/material-request.md
@@ -23,6 +23,7 @@ A Material Request can be of type:
* Purchase - If the request material is to be purchased.
* Material Transfer - If the requested material is to be shifted from one warehouse to another.
* Material Issue - If the requested material is to be Issued.
+* Manufacture - If the requested material is to be Produced.
> Info: Material Request is not mandatory. It is ideal if you have centralized
buying so that you can collect this information from various departments.
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index ad8b7760c32..399d576a6bc 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -139,16 +139,18 @@ erpnext.production_order = {
},
set_default_warehouse: function(frm) {
- frappe.call({
- method: "erpnext.manufacturing.doctype.production_order.production_order.get_default_warehouse",
+ if (!(frm.doc.wip_warehouse || frm.doc.fg_warehouse)) {
+ frappe.call({
+ method: "erpnext.manufacturing.doctype.production_order.production_order.get_default_warehouse",
- callback: function(r) {
- if(!r.exe) {
- frm.set_value("wip_warehouse", r.message.wip_warehouse);
- frm.set_value("fg_warehouse", r.message.fg_warehouse)
+ callback: function(r) {
+ if(!r.exe) {
+ frm.set_value("wip_warehouse", r.message.wip_warehouse);
+ frm.set_value("fg_warehouse", r.message.fg_warehouse)
+ }
}
- }
- });
+ });
+ }
}
}
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json
index ee39e049310..4a809cf439c 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.json
+++ b/erpnext/manufacturing/doctype/production_order/production_order.json
@@ -24,6 +24,7 @@
"options": "icon-gift",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -48,6 +49,7 @@
"options": "PRO-",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -75,6 +77,7 @@
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 1,
@@ -100,6 +103,7 @@
"options": "Item",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -127,6 +131,7 @@
"options": "BOM",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -151,6 +156,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -173,6 +179,7 @@
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -199,6 +206,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -225,6 +233,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -252,6 +261,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -275,6 +285,7 @@
"options": "icon-building",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -298,6 +309,7 @@
"options": "Warehouse",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -319,6 +331,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -344,6 +357,7 @@
"options": "Warehouse",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -368,6 +382,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -391,6 +406,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -415,6 +431,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -438,6 +455,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -460,6 +478,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -483,6 +502,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -506,6 +526,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -531,6 +552,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -556,6 +578,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -581,6 +604,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -605,6 +629,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -629,6 +654,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -653,6 +679,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -675,6 +702,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -699,6 +727,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -722,6 +751,7 @@
"options": "icon-file-text",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -744,6 +774,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -770,6 +801,7 @@
"options": "UOM",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -777,6 +809,32 @@
"set_only_once": 0,
"unique": 0
},
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Company",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldname": "company",
+ "oldfieldtype": "Link",
+ "options": "Company",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
{
"allow_on_submit": 0,
"bold": 0,
@@ -791,6 +849,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -817,6 +876,7 @@
"options": "Project",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -841,6 +901,7 @@
"options": "Sales Order",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -852,23 +913,48 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "company",
+ "description": "Manufacture against Material Request",
+ "fieldname": "material_request",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Company",
+ "label": "Material Request",
"length": 0,
"no_copy": 0,
- "oldfieldname": "company",
- "oldfieldtype": "Link",
- "options": "Company",
+ "options": "Material Request",
"permlevel": 0,
+ "precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "material_request_item",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Material Request Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -891,6 +977,7 @@
"options": "Production Order",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -909,7 +996,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2015-11-16 06:29:52.334735",
+ "modified": "2016-02-23 07:29:38.091748",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order",
@@ -958,5 +1045,6 @@
],
"read_only": 0,
"read_only_onload": 0,
+ "sort_order": "ASC",
"title_field": "production_item"
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 59d371a7c1b..210597ee98f 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -152,17 +152,19 @@ class ProductionOrder(Document):
frappe.throw(_("Work-in-Progress Warehouse is required before Submit"))
if not self.fg_warehouse:
frappe.throw(_("For Warehouse is required before Submit"))
+
frappe.db.set(self,'status', 'Submitted')
self.make_time_logs()
+ self.update_completed_qty_in_material_request()
self.update_planned_qty()
-
def on_cancel(self):
self.validate_cancel()
frappe.db.set(self,'status', 'Cancelled')
- self.update_planned_qty()
self.delete_time_logs()
+ self.update_completed_qty_in_material_request()
+ self.update_planned_qty()
def validate_cancel(self):
if self.status == "Stopped":
@@ -178,6 +180,14 @@ class ProductionOrder(Document):
update_bin_qty(self.production_item, self.fg_warehouse, {
"planned_qty": get_planned_qty(self.production_item, self.fg_warehouse)
})
+
+ if self.material_request:
+ mr_obj = frappe.get_doc("Material Request", self.material_request)
+ mr_obj.update_requested_qty([self.material_request_item])
+
+ def update_completed_qty_in_material_request(self):
+ if self.material_request:
+ frappe.get_doc("Material Request", self.material_request).update_completed_qty([self.material_request_item])
def set_production_order_operations(self):
"""Fetch operations from BOM and set in 'Production Order'"""
@@ -304,7 +314,8 @@ class ProductionOrder(Document):
def set_actual_dates(self):
if self.get("operations"):
- actual_date = frappe.db.sql("""select min(actual_start_time) as start_date, max(actual_end_time) as end_date from `tabProduction Order Operation`
+ actual_date = frappe.db.sql("""select min(actual_start_time) as start_date,
+ max(actual_end_time) as end_date from `tabProduction Order Operation`
where parent = %s and docstatus=1""", self.name, as_dict=1)[0]
self.actual_start_date = actual_date.start_date
self.actual_end_date = actual_date.end_date
diff --git a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
index 49d31c961c3..6138435ae77 100644
--- a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
+++ b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.json
@@ -26,6 +26,7 @@
"options": "Item",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "150px",
"read_only": 0,
"report_hide": 0,
@@ -53,6 +54,7 @@
"options": "BOM",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "100px",
"read_only": 0,
"report_hide": 0,
@@ -79,6 +81,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "100px",
"read_only": 0,
"report_hide": 0,
@@ -105,6 +108,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -116,53 +120,25 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "sales_order",
- "fieldtype": "Link",
+ "fieldname": "column_break_6",
+ "fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
- "in_list_view": 1,
- "label": "Sales Order",
+ "in_list_view": 0,
"length": 0,
"no_copy": 0,
- "oldfieldname": "source_docname",
- "oldfieldtype": "Data",
- "options": "Sales Order",
"permlevel": 0,
+ "precision": "",
"print_hide": 0,
- "read_only": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "fieldname": "so_pending_qty",
- "fieldtype": "Float",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "in_filter": 0,
- "in_list_view": 1,
- "label": "SO Pending Qty",
- "length": 0,
- "no_copy": 0,
- "oldfieldname": "prevdoc_reqd_qty",
- "oldfieldtype": "Currency",
- "permlevel": 0,
- "print_hide": 0,
- "print_width": "100px",
- "read_only": 1,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0,
- "width": "100px"
- },
{
"allow_on_submit": 0,
"bold": 0,
@@ -180,6 +156,7 @@
"options": "Warehouse",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -187,6 +164,84 @@
"set_only_once": 0,
"unique": 0
},
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "sales_order",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Sales Order",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldname": "source_docname",
+ "oldfieldtype": "Data",
+ "options": "Sales Order",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "material_request",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Material Request",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Material Request",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "pending_qty",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "label": "Pending Qty",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldname": "prevdoc_reqd_qty",
+ "oldfieldtype": "Currency",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "print_width": "100px",
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0,
+ "width": "100px"
+ },
{
"allow_on_submit": 0,
"bold": 0,
@@ -205,6 +260,7 @@
"options": "UOM",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "80px",
"read_only": 1,
"report_hide": 0,
@@ -231,6 +287,7 @@
"oldfieldtype": "Text",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "200px",
"read_only": 1,
"report_hide": 0,
@@ -239,6 +296,30 @@
"set_only_once": 0,
"unique": 0,
"width": "200px"
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "material_request_item",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "material_request_item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
}
],
"hide_heading": 0,
@@ -250,12 +331,13 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2015-11-16 06:29:52.572122",
+ "modified": "2016-02-11 05:08:19.492712",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan Item",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
- "read_only_onload": 0
+ "read_only_onload": 0,
+ "sort_order": "ASC"
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_plan_material_request/__init__.py b/erpnext/manufacturing/doctype/production_plan_material_request/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.json b/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.json
new file mode 100644
index 00000000000..739c97f943a
--- /dev/null
+++ b/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.json
@@ -0,0 +1,114 @@
+{
+ "allow_copy": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "hash",
+ "creation": "2016-02-10 05:09:11.983251",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "fields": [
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "material_request",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "label": "Material Request",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldname": "prevdoc_docname",
+ "oldfieldtype": "Data",
+ "options": "Material Request",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "print_width": "150px",
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0,
+ "width": "150px"
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "col_break1",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "material_request_date",
+ "fieldtype": "Date",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "label": "Material Request Date",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldname": "document_date",
+ "oldfieldtype": "Date",
+ "options": "",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "print_width": "120px",
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0,
+ "width": "120px"
+ }
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2016-02-23 02:06:15.169120",
+ "modified_by": "Administrator",
+ "module": "Manufacturing",
+ "name": "Production Plan Material Request",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "read_only": 0,
+ "read_only_onload": 0,
+ "sort_field": "modified",
+ "sort_order": "ASC"
+}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.py b/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.py
new file mode 100644
index 00000000000..44786f8388d
--- /dev/null
+++ b/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class ProductionPlanMaterialRequest(Document):
+ pass
diff --git a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
index d7fdea5a0ae..5eaa2746106 100644
--- a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
+++ b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.json
@@ -26,6 +26,7 @@
"options": "Sales Order",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "150px",
"read_only": 0,
"report_hide": 0,
@@ -45,13 +46,15 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
- "label": "SO Date",
+ "label": "Salse Order Date",
"length": 0,
"no_copy": 0,
"oldfieldname": "document_date",
"oldfieldtype": "Date",
+ "options": "",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
@@ -76,6 +79,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -99,6 +103,7 @@
"options": "Customer",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
@@ -112,6 +117,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "",
"fieldname": "grand_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -121,9 +127,10 @@
"label": "Grand Total",
"length": 0,
"no_copy": 0,
- "options": "Company:company:default_currency",
+ "options": "",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"print_width": "120px",
"read_only": 1,
"report_hide": 0,
@@ -143,12 +150,13 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2015-11-16 06:29:52.629618",
+ "modified": "2016-02-23 02:13:07.340323",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan Sales Order",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
- "read_only_onload": 0
+ "read_only_onload": 0,
+ "sort_order": "ASC"
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
index 15c4245fe5e..6824013d68d 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
@@ -3,36 +3,82 @@
frappe.require("assets/erpnext/js/utils.js");
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
+cur_frm.cscript.onload = function(doc) {
cur_frm.set_value("company", frappe.defaults.get_user_default("Company"))
- cur_frm.set_value("use_multi_level_bom", 1)
}
cur_frm.cscript.refresh = function(doc) {
cur_frm.disable_save();
}
-cur_frm.cscript.sales_order = function(doc,cdt,cdn) {
- var d = locals[cdt][cdn];
- if (d.sales_order) {
- return get_server_fields('get_so_details', d.sales_order, 'sales_orders', doc, cdt, cdn, 1);
+cur_frm.add_fetch("material_request", "transaction_date", "material_request_date");
+
+cur_frm.add_fetch("sales_order", "transaction_date", "sales_order_date");
+cur_frm.add_fetch("sales_order", "customer", "customer");
+cur_frm.add_fetch("sales_order", "base_grand_total", "grand_total");
+
+frappe.ui.form.on("Production Planning Tool", {
+ get_sales_orders: function(frm) {
+ frappe.call({
+ doc: frm.doc,
+ method: "get_open_sales_orders",
+ callback: function(r) {
+ refresh_field("sales_orders");
+ }
+ });
+ },
+
+ get_material_request: function(frm) {
+ frappe.call({
+ doc: frm.doc,
+ method: "get_pending_material_requests",
+ callback: function(r) {
+ refresh_field("material_requests");
+ }
+ });
+ },
+
+ get_items: function(frm) {
+ frappe.call({
+ doc: frm.doc,
+ method: "get_items",
+ callback: function(r) {
+ refresh_field("items");
+ }
+ });
+ },
+
+ create_production_order: function(frm) {
+ frappe.call({
+ doc: frm.doc,
+ method: "raise_production_orders"
+ });
+ },
+
+ create_material_requests: function(frm) {
+ frappe.call({
+ doc: frm.doc,
+ method: "raise_material_requests"
+ });
}
-}
+});
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
var d = locals[cdt][cdn];
if (d.item_code) {
- return get_server_fields('get_item_details', d.item_code, 'items', doc, cdt, cdn, 1);
+ frappe.call({
+ method: "erpnext.manufacturing.doctype.production_order.production_order.get_item_details",
+ args: {
+ "item" : d.item_code
+ },
+ callback: function(r) {
+ $.extend(d, r.message);
+ refresh_field("items");
+ }
+ });
}
}
-cur_frm.cscript.raise_purchase_request = function(doc, cdt, cdn) {
- return frappe.call({
- method: "raise_purchase_request",
- doc:doc
- })
-}
-
cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) {
return $c_obj(doc, 'validate_data', '', function(r, rt) {
if (!r['exc'])
@@ -40,7 +86,6 @@ cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) {
});
}
-
cur_frm.fields_dict['sales_orders'].grid.get_field('sales_order').get_query = function(doc) {
var args = { "docstatus": 1 };
if(doc.customer) {
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
index e54b168776f..9ccd55e9ae3 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
@@ -12,17 +12,21 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "description": "Select Sales Orders from which you want to create Production Orders.",
- "fieldname": "select_sales_orders",
- "fieldtype": "Section Break",
+ "default": "Sales Order",
+ "fieldname": "get_items_from",
+ "fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Select Sales Orders",
+ "label": "Get Items From",
+ "length": 0,
"no_copy": 0,
+ "options": "\nSales Order\nMaterial Request",
"permlevel": 0,
+ "precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -34,22 +38,26 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "column_break0",
- "fieldtype": "Column Break",
+ "depends_on": "get_items_from",
+ "description": "",
+ "fieldname": "filters",
+ "fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
+ "label": "Filters",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "unique": 0,
- "width": "50%"
+ "unique": 0
},
{
"allow_on_submit": 0,
@@ -61,11 +69,13 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
- "label": "Filter based on item",
+ "label": "Item",
+ "length": 0,
"no_copy": 0,
"options": "Item",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -77,17 +87,20 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "depends_on": "eval: doc.get_items_from == \"Sales Order\"",
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
- "label": "Filter based on customer",
+ "label": "Customer",
+ "length": 0,
"no_copy": 0,
"options": "Customer",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -99,6 +112,33 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "depends_on": "eval: doc.get_items_from == \"Material Request\"",
+ "fieldname": "warehouse",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Warehouse",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Warehouse",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "depends_on": "eval: doc.get_items_from == \"Sales Order\"",
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@@ -106,13 +146,15 @@
"in_filter": 0,
"in_list_view": 1,
"label": "Company",
+ "length": 0,
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -127,9 +169,11 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -149,9 +193,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "From Date",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -170,9 +216,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "To Date",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -184,16 +232,19 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "depends_on": "eval: doc.get_items_from == \"Sales Order\"",
"fieldname": "section_break1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
+ "length": 0,
"no_copy": 0,
- "options": "Simple",
+ "options": "",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -213,10 +264,12 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Get Sales Orders",
+ "length": 0,
"no_copy": 0,
- "options": "get_open_sales_orders",
+ "options": "",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -235,10 +288,87 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Orders",
+ "length": 0,
"no_copy": 0,
"options": "Production Plan Sales Order",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "depends_on": "eval: doc.get_items_from == \"Material Request\"",
+ "fieldname": "section_break_16",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "description": "Pull Material Request of type Manufacture based on the above criteria",
+ "fieldname": "get_material_request",
+ "fieldtype": "Button",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Get Material Request",
+ "length": 0,
+ "no_copy": 0,
+ "options": "",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "material_requests",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Material Requests",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Production Plan Material Request",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -257,9 +387,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Select Items",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -271,17 +403,20 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "get_items_from_so",
+ "depends_on": "get_items_from",
+ "fieldname": "get_items",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Get Items From Sales Orders",
+ "label": "Get Items",
+ "length": 0,
"no_copy": 0,
- "options": "get_items_from_so",
+ "options": "",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -294,6 +429,7 @@
"bold": 0,
"collapsible": 0,
"default": "1",
+ "depends_on": "get_items_from",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"fieldname": "use_multi_level_bom",
"fieldtype": "Check",
@@ -302,9 +438,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Use Multi-Level BOM",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -323,10 +461,12 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Items",
+ "length": 0,
"no_copy": 0,
"options": "Production Plan Item",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -346,9 +486,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Production Orders",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -361,17 +503,19 @@
"bold": 0,
"collapsible": 0,
"description": "Separate production order will be created for each finished good item.",
- "fieldname": "raise_production_order",
+ "fieldname": "create_production_order",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Production Orders",
+ "length": 0,
"no_copy": 0,
- "options": "raise_production_order",
+ "options": "",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -383,6 +527,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "depends_on": "",
"fieldname": "sb5",
"fieldtype": "Section Break",
"hidden": 0,
@@ -390,9 +535,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Material Requirement",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -411,10 +558,12 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Material Request For Warehouse",
+ "length": 0,
"no_copy": 0,
"options": "Warehouse",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -427,17 +576,19 @@
"bold": 0,
"collapsible": 0,
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty",
- "fieldname": "raise_purchase_request",
+ "fieldname": "create_material_requests",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Material Requests",
+ "length": 0,
"no_copy": 0,
"options": "",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -457,9 +608,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Download Materials Required",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -477,7 +630,8 @@
"is_submittable": 0,
"issingle": 1,
"istable": 0,
- "modified": "2015-06-05 11:44:31.629114",
+ "max_attachments": 0,
+ "modified": "2016-02-23 02:37:51.260645",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Planning Tool",
@@ -505,5 +659,6 @@
}
],
"read_only": 1,
- "read_only_onload": 0
+ "read_only_onload": 0,
+ "sort_order": "ASC"
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 46396ba1038..ea7e660dd52 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -16,25 +16,8 @@ class ProductionPlanningTool(Document):
super(ProductionPlanningTool, self).__init__(arg1, arg2)
self.item_dict = {}
- def get_so_details(self, so):
- """Pull other details from so"""
- so = frappe.db.sql("""select transaction_date, customer, base_grand_total
- from `tabSales Order` where name = %s""", so, as_dict = 1)
- ret = {
- 'sales_order_date': so and so[0]['transaction_date'] or '',
- 'customer' : so[0]['customer'] or '',
- 'grand_total': so[0]['base_grand_total']
- }
- return ret
-
- def get_item_details(self, item_code):
- return get_item_details(item_code)
-
- def clear_so_table(self):
- self.set('sales_orders', [])
-
- def clear_item_table(self):
- self.set('items', [])
+ def clear_table(self, table_name):
+ self.set(table_name, [])
def validate_company(self):
if not self.company:
@@ -78,9 +61,9 @@ class ProductionPlanningTool(Document):
def add_so_in_table(self, open_so):
""" Add sales orders in the table"""
- self.clear_so_table()
+ self.clear_table("sales_orders")
- so_list = [d.sales_order for d in self.get('sales_orders')]
+ so_list = []
for r in open_so:
if cstr(r['name']) not in so_list:
pp_so = self.append('sales_orders', {})
@@ -88,19 +71,59 @@ class ProductionPlanningTool(Document):
pp_so.sales_order_date = cstr(r['transaction_date'])
pp_so.customer = cstr(r['customer'])
pp_so.grand_total = flt(r['base_grand_total'])
+
+ def get_pending_material_requests(self):
+ """ Pull Material Requests that are pending based on criteria selected"""
+ mr_filter = item_filter = ""
+ if self.from_date:
+ mr_filter += " and mr.transaction_date >= %(from_date)s"
+ if self.to_date:
+ mr_filter += " and mr.transaction_date <= %(to_date)s"
+ if self.warehouse:
+ mr_filter += " and mr_item.warehouse = %(warehouse)s"
+
+ if self.fg_item:
+ item_filter += " and item.name = %(item)s"
- def get_items_from_so(self):
- """ Pull items from Sales Order, only proction item
- and subcontracted item will be pulled from Packing item
- and add items in the table
- """
- items = self.get_items()
- self.add_items(items)
+ pending_mr = frappe.db.sql("""
+ select distinct mr.name, mr.transaction_date
+ from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
+ where mr_item.parent = mr.name
+ and mr.material_request_type = "Manufacture"
+ and mr.docstatus = 1
+ and mr_item.qty > mr_item.ordered_qty {0}
+ and (exists (select name from `tabItem` item where item.name=mr_item.item_code
+ and (item.is_pro_applicable = 1 or item.is_sub_contracted_item = 1 {1})))
+ """.format(mr_filter, item_filter), {
+ "from_date": self.from_date,
+ "to_date": self.to_date,
+ "warehouse": self.warehouse,
+ "item": self.fg_item
+ }, as_dict=1)
+
+ self.add_mr_in_table(pending_mr)
+
+ def add_mr_in_table(self, pending_mr):
+ """ Add Material Requests in the table"""
+ self.clear_table("material_requests")
+
+ mr_list = []
+ for r in pending_mr:
+ if cstr(r['name']) not in mr_list:
+ mr = self.append('material_requests', {})
+ mr.material_request = r['name']
+ mr.material_request_date = cstr(r['transaction_date'])
def get_items(self):
- so_list = filter(None, [d.sales_order for d in self.get('sales_orders')])
+ if self.get_items_from == "Sales Order":
+ self.get_so_items()
+ elif self.get_items_from == "Material Request":
+ self.get_mr_items()
+
+ def get_so_items(self):
+ so_list = [d.sales_order for d in self.get('sales_orders') if d.sales_order]
if not so_list:
- msgprint(_("Please enter sales order in the above table"))
+ msgprint(_("Please enter Sales Orders in the above table"))
return []
item_condition = ""
@@ -131,101 +154,155 @@ class ProductionPlanningTool(Document):
or item.is_sub_contracted_item = 1)) %s""" % \
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
- return items + packed_items
+ self.add_items(items + packed_items)
+
+ def get_mr_items(self):
+ mr_list = [d.material_request for d in self.get('material_requests') if d.material_request]
+ if not mr_list:
+ msgprint(_("Please enter Material Requests in the above table"))
+ return []
+ item_condition = ""
+ if self.fg_item:
+ item_condition = ' and mr_item.item_code = "' + frappe.db.escape(self.fg_item, percent=False) + '"'
+
+ items = frappe.db.sql("""select distinct parent, name, item_code, warehouse,
+ (qty - ordered_qty) as pending_qty
+ from `tabMaterial Request Item` mr_item
+ where parent in (%s) and docstatus = 1 and qty > ordered_qty
+ and exists (select * from `tabItem` item where item.name=mr_item.item_code
+ and (item.is_pro_applicable = 1
+ or item.is_sub_contracted_item = 1)) %s""" % \
+ (", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
+
+ self.add_items(items)
+
def add_items(self, items):
- self.clear_item_table()
-
+ self.clear_table("items")
for p in items:
item_details = get_item_details(p['item_code'])
pi = self.append('items', {})
- pi.sales_order = p['parent']
pi.warehouse = p['warehouse']
pi.item_code = p['item_code']
pi.description = item_details and item_details.description or ''
pi.stock_uom = item_details and item_details.stock_uom or ''
pi.bom_no = item_details and item_details.bom_no or ''
- pi.so_pending_qty = flt(p['pending_qty'])
pi.planned_qty = flt(p['pending_qty'])
-
+ pi.pending_qty = flt(p['pending_qty'])
+
+ if self.get_items_from == "Sales Order":
+ pi.sales_order = p['parent']
+ elif self.get_items_from == "Material Request":
+ pi.material_request = p['parent']
+ pi.material_request_item = p['name']
+
def validate_data(self):
self.validate_company()
for d in self.get('items'):
- validate_bom_no(d.item_code, d.bom_no)
+ if not d.bom_no:
+ frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
+ else:
+ validate_bom_no(d.item_code, d.bom_no)
+
if not flt(d.planned_qty):
frappe.throw(_("Please enter Planned Qty for Item {0} at row {1}").format(d.item_code, d.idx))
- def raise_production_order(self):
+ def raise_production_orders(self):
"""It will raise production order (Draft) for all distinct FG items"""
self.validate_data()
from erpnext.utilities.transaction_base import validate_uom_is_integer
validate_uom_is_integer(self, "stock_uom", "planned_qty")
- items = self.get_distinct_items_and_boms()[1]
- pro = self.create_production_order(items)
- if pro:
- pro = ["""%s""" % \
- (p, p) for p in pro]
- msgprint(_("{0} created").format(comma_and(pro)))
+ items = self.get_production_items()
+
+ pro_list = []
+ frappe.flags.mute_messages = True
+
+ for key in items:
+ production_order = self.create_production_order(items[key])
+ if production_order:
+ pro_list.append(production_order)
+
+ frappe.flags.mute_messages = False
+
+ if pro_list:
+ pro_list = ["""%s""" % \
+ (p, p) for p in pro_list]
+ msgprint(_("{0} created").format(comma_and(pro_list)))
else :
msgprint(_("No Production Orders created"))
- def get_distinct_items_and_boms(self):
- """ Club similar BOM and item for processing
+ def get_production_items(self):
+ item_dict = {}
+ for d in self.get("items"):
+ item_details= {
+ "production_item" : d.item_code,
+ "sales_order" : d.sales_order,
+ "material_request" : d.material_request,
+ "material_request_item" : d.material_request_item,
+ "bom_no" : d.bom_no,
+ "description" : d.description,
+ "stock_uom" : d.stock_uom,
+ "company" : self.company,
+ "wip_warehouse" : "",
+ "fg_warehouse" : d.warehouse,
+ "status" : "Draft",
+ }
+
+ """ Club similar BOM and item for processing in case of Sales Orders """
+ if self.get_items_from == "Material Request":
+ item_details.update({
+ "qty": d.planned_qty
+ })
+ item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details
+
+ else:
+ item_details.update({
+ "qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{})
+ .get("qty")) + flt(d.planned_qty)
+ })
+ item_dict[(d.item_code, d.sales_order, d.warehouse)] = item_details
+
+ return item_dict
+
+ def create_production_order(self, item_dict):
+ """Create production order. Called from Production Planning Tool"""
+ from erpnext.manufacturing.doctype.production_order.production_order import OverProductionError, get_default_warehouse
+ warehouse = get_default_warehouse()
+ pro = frappe.new_doc("Production Order")
+ pro.update(item_dict)
+ pro.set_production_order_operations()
+ if warehouse:
+ pro.wip_warehouse = warehouse.get('wip_warehouse')
+ if not pro.fg_warehouse:
+ pro.fg_warehouse = warehouse.get('fg_warehouse')
+
+ try:
+ pro.insert()
+ return pro.name
+ except OverProductionError:
+ pass
+
+ def get_so_wise_planned_qty(self):
+ """
bom_dict {
bom_no: ['sales_order', 'qty']
}
"""
- item_dict, bom_dict = {}, {}
+ bom_dict = {}
for d in self.get("items"):
- if d.bom_no:
+ if self.get_items_from == "Material Request":
+ bom_dict.setdefault(d.bom_no, []).append([d.material_request_item, flt(d.planned_qty)])
+ else:
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
- if frappe.db.get_value("Item", d.item_code, "is_pro_applicable"):
- item_dict[(d.item_code, d.sales_order, d.warehouse)] = {
- "production_item" : d.item_code,
- "sales_order" : d.sales_order,
- "qty" : flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),
- {}).get("qty")) + flt(d.planned_qty),
- "bom_no" : d.bom_no,
- "description" : d.description,
- "stock_uom" : d.stock_uom,
- "company" : self.company,
- "wip_warehouse" : "",
- "fg_warehouse" : d.warehouse,
- "status" : "Draft",
- }
- return bom_dict, item_dict
-
- def create_production_order(self, items):
- """Create production order. Called from Production Planning Tool"""
- from erpnext.manufacturing.doctype.production_order.production_order import OverProductionError, get_default_warehouse
- warehouse = get_default_warehouse()
- pro_list = []
- for key in items:
- pro = frappe.new_doc("Production Order")
- pro.update(items[key])
- pro.set_production_order_operations()
- if warehouse:
- pro.wip_warehouse = warehouse.get('wip_warehouse')
- if not pro.fg_warehouse:
- pro.fg_warehouse = warehouse.get('fg_warehouse')
- frappe.flags.mute_messages = True
-
- try:
- pro.insert()
- pro_list.append(pro.name)
- except OverProductionError:
- pass
-
- frappe.flags.mute_messages = False
- return pro_list
-
+ return bom_dict
+
def download_raw_materials(self):
""" Create csv data for required raw material to produce finished goods"""
self.validate_data()
- bom_dict = self.get_distinct_items_and_boms()[0]
+ bom_dict = self.get_so_wise_planned_qty()
self.get_raw_materials(bom_dict)
return self.get_csv()
@@ -265,7 +342,6 @@ class ProductionPlanningTool(Document):
and item.is_stock_item = 1
group by item_code""", bom, as_dict=1):
bom_wise_item_details.setdefault(d.item_code, d)
-
for item, item_details in bom_wise_item_details.items():
for so_qty in so_wise_qty:
item_list.append([item, flt(item_details.qty) * so_qty[1], item_details.description,
@@ -295,7 +371,7 @@ class ProductionPlanningTool(Document):
return item_list
- def raise_purchase_request(self):
+ def raise_material_requests(self):
"""
Raise Material Request if projected qty is less than qty required
Requested qty should be shortage qty considering minimum order qty
@@ -304,11 +380,11 @@ class ProductionPlanningTool(Document):
if not self.purchase_request_for_warehouse:
frappe.throw(_("Please enter Warehouse for which Material Request will be raised"))
- bom_dict = self.get_distinct_items_and_boms()[0]
+ bom_dict = self.get_so_wise_planned_qty()
self.get_raw_materials(bom_dict)
if self.item_dict:
- self.insert_purchase_request()
+ self.create_material_request()
def get_requested_items(self):
item_projected_qty = self.get_projected_qty()
@@ -329,6 +405,8 @@ class ProductionPlanningTool(Document):
for item_details in so_item_qty:
if requested_qty:
sales_order = item_details[4] or "No Sales Order"
+ if self.get_items_from == "Material Request":
+ sales_order = "No Sales Order"
if requested_qty <= item_details[0]:
adjusted_qty = requested_qty
else:
@@ -355,15 +433,15 @@ class ProductionPlanningTool(Document):
return dict(item_projected_qty)
- def insert_purchase_request(self):
+ def create_material_request(self):
items_to_be_requested = self.get_requested_items()
- purchase_request_list = []
+ material_request_list = []
if items_to_be_requested:
for item in items_to_be_requested:
item_wrapper = frappe.get_doc("Item", item)
- pr_doc = frappe.new_doc("Material Request")
- pr_doc.update({
+ material_request = frappe.new_doc("Material Request")
+ material_request.update({
"transaction_date": nowdate(),
"status": "Draft",
"company": self.company,
@@ -371,7 +449,7 @@ class ProductionPlanningTool(Document):
"material_request_type": "Purchase"
})
for sales_order, requested_qty in items_to_be_requested[item].items():
- pr_doc.append("items", {
+ material_request.append("items", {
"doctype": "Material Request Item",
"__islocal": 1,
"item_code": item,
@@ -383,16 +461,16 @@ class ProductionPlanningTool(Document):
"qty": requested_qty,
"schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)),
"warehouse": self.purchase_request_for_warehouse,
- "sales_order_no": sales_order if sales_order!="No Sales Order" else None
+ "sales_order": sales_order if sales_order!="No Sales Order" else None
})
- pr_doc.flags.ignore_permissions = 1
- pr_doc.submit()
- purchase_request_list.append(pr_doc.name)
+ material_request.flags.ignore_permissions = 1
+ material_request.submit()
+ material_request_list.append(material_request.name)
- if purchase_request_list:
- pur_req = ["""%s""" % \
- (p, p) for p in purchase_request_list]
- msgprint(_("Material Requests {0} created").format(comma_and(pur_req)))
+ if material_request_list:
+ message = ["""%s""" % \
+ (p, p) for p in material_request_list]
+ msgprint(_("Material Requests {0} created").format(comma_and(message)))
else:
msgprint(_("Nothing to request"))
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 2239f0a48d7..e5ec4548d00 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -248,3 +248,4 @@ execute:frappe.db.sql("update `tabPricing Rule` set title=name where title='' or
erpnext.patches.v6_20.set_party_account_currency_in_orders
erpnext.patches.v6_19.comment_feed_communication
erpnext.patches.v6_21.fix_reorder_level
+erpnext.patches.v6_21.rename_material_request_fields
diff --git a/erpnext/patches/v6_21/__init__.py b/erpnext/patches/v6_21/__init__.py
index e69de29bb2d..baffc488252 100644
--- a/erpnext/patches/v6_21/__init__.py
+++ b/erpnext/patches/v6_21/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/patches/v6_21/rename_material_request_fields.py b/erpnext/patches/v6_21/rename_material_request_fields.py
new file mode 100644
index 00000000000..07be27a5d6d
--- /dev/null
+++ b/erpnext/patches/v6_21/rename_material_request_fields.py
@@ -0,0 +1,14 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+ frappe.reload_doc('stock', 'doctype', 'material_request_item')
+ rename_field("Material Request Item", "sales_order_no", "sales_order")
+
+ frappe.reload_doc('support', 'doctype', 'maintenance_schedule_item')
+ rename_field("Maintenance Schedule Item", "prevdoc_docname", "sales_order")
+
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index d735bea01bb..590f7492014 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -193,7 +193,7 @@ class SalesOrder(SellingController):
#check maintenance schedule
submit_ms = frappe.db.sql_list("""select t1.name from `tabMaintenance Schedule` t1,
`tabMaintenance Schedule Item` t2
- where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1""", self.name)
+ where t2.parent=t1.name and t2.sales_order = %s and t1.docstatus = 1""", self.name)
if submit_ms:
frappe.throw(_("Maintenance Schedule {0} must be cancelled before cancelling this Sales Order").format(comma_and(submit_ms)))
@@ -353,7 +353,7 @@ def make_material_request(source_name, target_doc=None):
item_table: {
"doctype": "Material Request Item",
"field_map": {
- "parent": "sales_order_no",
+ "parent": "sales_order",
"stock_uom": "uom"
}
}
@@ -464,15 +464,12 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
def make_maintenance_schedule(source_name, target_doc=None):
maint_schedule = frappe.db.sql("""select t1.name
from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2
- where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1""", source_name)
+ where t2.parent=t1.name and t2.sales_order=%s and t1.docstatus=1""", source_name)
if not maint_schedule:
doclist = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {
"doctype": "Maintenance Schedule",
- "field_map": {
- "name": "sales_order_no"
- },
"validation": {
"docstatus": ["=", 1]
}
@@ -480,7 +477,7 @@ def make_maintenance_schedule(source_name, target_doc=None):
"Sales Order Item": {
"doctype": "Maintenance Schedule Item",
"field_map": {
- "parent": "prevdoc_docname"
+ "parent": "sales_order"
},
"add_if_empty": True
}
@@ -499,9 +496,6 @@ def make_maintenance_visit(source_name, target_doc=None):
doclist = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {
"doctype": "Maintenance Visit",
- "field_map": {
- "name": "sales_order_no"
- },
"validation": {
"docstatus": ["=", 1]
}
diff --git a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json
index 6d431faa217..6b19b6394bc 100644
--- a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json
+++ b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.json
@@ -12,7 +12,7 @@
"module": "Selling",
"name": "Pending SO Items For Purchase Request",
"owner": "Administrator",
- "query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order_no = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Stopped\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc",
+ "query": "select so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\",\n sum(so_item.qty) - sum(mr_item.qty) as \"Pending Qty:Float:100 \", \n so.company as \"Company:Link/Company:\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere \n so_item.`parent` = so.`name` \n and mr_item.parent = mr.name\n and mr_item.sales_order = so.name\n and mr_item.item_code = so_item.item_code\n and so.docstatus = 1 and so.status != \"Stopped\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\nhaving sum(so_item.qty) > sum(mr_item.qty)\norder by so.name desc, so_item.item_code asc",
"ref_doctype": "Sales Order",
"report_name": "Pending SO Items For Purchase Request",
"report_type": "Query Report"
diff --git a/erpnext/stock/doctype/bin/bin.json b/erpnext/stock/doctype/bin/bin.json
index 37fe0a47778..9eb3995cc98 100644
--- a/erpnext/stock/doctype/bin/bin.json
+++ b/erpnext/stock/doctype/bin/bin.json
@@ -26,6 +26,7 @@
"options": "Warehouse",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -51,6 +52,7 @@
"options": "Item",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -76,6 +78,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -101,6 +104,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -126,6 +130,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -144,13 +149,14 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Quantity Requested for Purchase",
+ "label": "Requested Quantity",
"length": 0,
"no_copy": 0,
"oldfieldname": "indented_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -175,6 +181,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -199,6 +206,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -223,6 +231,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
@@ -248,6 +257,7 @@
"options": "UOM",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -272,6 +282,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
@@ -296,6 +307,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -320,6 +332,7 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -337,7 +350,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2015-11-16 06:29:42.363502",
+ "modified": "2016-02-10 02:39:45.738623",
"modified_by": "Administrator",
"module": "Stock",
"name": "Bin",
@@ -406,5 +419,6 @@
],
"read_only": 0,
"read_only_onload": 0,
- "search_fields": "item_code,warehouse"
+ "search_fields": "item_code,warehouse",
+ "sort_order": "ASC"
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 679d9105f7e..7407975a60e 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -193,48 +193,6 @@ cur_frm.cscript.print_without_amount = function(doc, cdt, cdn) {
erpnext.stock.delivery_note.set_print_hide(doc, cdt, cdn);
}
-
-//****************** For print sales order no and date*************************
-cur_frm.pformat.sales_order_no= function(doc, cdt, cdn){
- //function to make row of table
-
- var make_row = function(title,val1, val2, bold){
- var bstart = ''; var bend = '';
-
- return '| ';
-
- // main table
- out +=' |