From 92a3dbb5d335929b05600430ee6d1568df226575 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 24 Aug 2015 15:52:27 +0530 Subject: [PATCH] Fixes in Default Warehouse --- .../doctype/production_order/production_order.js | 6 +++--- .../doctype/production_order/production_order.py | 2 +- .../production_planning_tool/production_planning_tool.py | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index cf02a3a7475..00eac9ad7a0 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -12,12 +12,12 @@ frappe.ui.form.on("Production Order", "onload", function(frm) { "actual_start_date": "", "actual_end_date": "" }); + erpnext.production_order.set_default_warehouse(frm); } erpnext.production_order.set_custom_buttons(frm); erpnext.production_order.setup_company_filter(frm); erpnext.production_order.setup_bom_filter(frm); - erpnext.production_order.set_default_warehouse(frm); }); frappe.ui.form.on("Production Order", "refresh", function(frm) { @@ -147,8 +147,8 @@ erpnext.production_order = { callback: function(r) { if(!r.exe) { - frm.set_value("wip_warehouse", r.message[0]); - frm.set_value("fg_warehouse", r.message[1]) + 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.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 182f306c111..6299736d950 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -427,4 +427,4 @@ def make_time_log(name, operation, from_time=None, to_time=None, qty=None, proj def get_default_warehouse(): wip_warehouse = frappe.db.get_single_value("Manufacturing Settings", "default_wip_warehouse") fg_warehouse = frappe.db.get_single_value("Manufacturing Settings", "default_fg_warehouse") - return wip_warehouse, fg_warehouse \ No newline at end of file + return {"wip_warehouse": wip_warehouse, "fg_warehouse": fg_warehouse} \ 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 3f08b1beaed..254b5a58fa7 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -208,9 +208,11 @@ class ProductionPlanningTool(Document): pro.update(items[key]) pro.set_production_order_operations() if warehouse: - pro.wip_warehouse = warehouse[0] - pro.fg_warehouse = warehouse[1] + 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) @@ -218,7 +220,6 @@ class ProductionPlanningTool(Document): pass frappe.flags.mute_messages = False - return pro_list def download_raw_materials(self):