From 240f629458ed6076137c8e05383e619633f99df2 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 23 Mar 2016 12:05:45 +0530 Subject: [PATCH] Validate purchase item only if material request type is purchase --- erpnext/buying/doctype/purchase_common/purchase_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index df63e291ba..be704e9fba 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -69,7 +69,7 @@ class PurchaseCommon(BuyingController): frappe.throw(_("Warehouse is mandatory for stock Item {0} in row {1}").format(d.item_code, d.idx)) # validate purchase item - if not (obj.doctype=="Material Request" and getattr(obj, "material_request_type", None)=="Material Transfer"): + if obj.doctype=="Material Request" and getattr(obj, "material_request_type", None)=="Purchase": if item.is_purchase_item != 1 and item.is_sub_contracted_item != 1: frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx))