SO and DN mandatory only for stock item if made mandatory in global defaults
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index ce83db0..3231523 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -141,8 +141,7 @@
def so_required(self):
"""check in manage account if sales order required or not"""
- res = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'so_required'")
- if res and res[0][0] == 'Yes':
+ if webnotes.conn.get_value('Global Defaults', 'Global Defaults', 'so_required') == 'Yes':
for d in getlist(self.doclist,'delivery_note_details'):
if not d.prevdoc_docname:
msgprint("Sales Order No. required against item %s"%d.item_code)