From 4f017042345fa797566816dbc7258852b9242dfd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 17 Mar 2016 19:14:15 +0530 Subject: [PATCH 1/2] [fix] Fetch shipping address only if field exists --- erpnext/buying/doctype/purchase_common/purchase_common.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 26b4221d9b8..9a9a865233b 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -174,8 +174,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ company: function() { var me = this; - if (!this.frm.doc.shipping_address) { - erpnext.utils.get_shipping_address(this.frm) + if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") + && !this.frm.doc.shipping_address) { + erpnext.utils.get_shipping_address(this.frm) } }, From 24f1c50dcaf40fe8e6e9bc0f808d8f52224c5567 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 17 Mar 2016 19:14:43 +0530 Subject: [PATCH 2/2] Create sample Material Requests via setup wizard only if warehouse exists --- erpnext/setup/setup_wizard/sample_data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/setup_wizard/sample_data.py b/erpnext/setup/setup_wizard/sample_data.py index 0e9ef064d1a..63fc2e7a143 100644 --- a/erpnext/setup/setup_wizard/sample_data.py +++ b/erpnext/setup/setup_wizard/sample_data.py @@ -15,6 +15,7 @@ def make_sample_data(): selling_items = frappe.get_all("Item", filters = {"is_sales_item": 1}) buying_items = frappe.get_all("Item", filters = {"is_purchase_item": 1}) customers = frappe.get_all("Customer") + warehouses = frappe.get_all("Warehouse") if selling_items and customers: for i in range(3): @@ -24,7 +25,7 @@ def make_sample_data(): make_projects() - if buying_items: + if buying_items and warehouses: make_material_request(buying_items) frappe.db.commit()