From e7c01887326710c119d85a887f0705814a9fa888 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 31 Mar 2017 13:40:06 +0530 Subject: [PATCH] [enhance] Get project from bom on production order --- .../manufacturing/doctype/production_order/production_order.js | 2 +- .../manufacturing/doctype/production_order/production_order.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 1217790113..60373972b9 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -218,7 +218,7 @@ $.extend(cur_frm.cscript, { project: doc.project }, callback: function(r) { - $.each(["description", "stock_uom", "bom_no"], function(i, field) { + $.each(["description", "stock_uom", "project", "bom_no"], function(i, field) { cur_frm.set_value(field, r.message[field]); }); diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 2d9a06711a..b9b10c159a 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -498,6 +498,7 @@ def get_item_details(item, project = None): frappe.throw(_("Default BOM for {0} not found for Project {1}").format(item, project)) frappe.throw(_("Default BOM for {0} not found").format(item)) + res['project'] = frappe.db.get_value('BOM', res['bom_no'], 'project') res.update(check_if_scrap_warehouse_mandatory(res["bom_no"])) return res