blanket order related fixes
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.json b/erpnext/manufacturing/doctype/blanket_order/blanket_order.json
index e2d26f4..84e0816 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.json
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.json
@@ -274,7 +274,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 0,
+ "reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
@@ -306,7 +306,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 0,
+ "reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
@@ -452,7 +452,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-06-04 06:36:36.933751",
+ "modified": "2018-06-14 18:06:48.009635",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Blanket Order",
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 2eed4c9..6d89187 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -749,19 +749,23 @@
args = frappe._dict(json.loads(args))
blanket_order_details = None
- condition1, condition2 = ' ', ' '
+ condition = ''
if args.item_code:
if args.customer and args.doctype == "Sales Order":
- condition1 = ' and bo.customer=%(customer)s '
+ condition = ' and bo.customer=%(customer)s'
elif args.supplier and args.doctype == "Purchase Order":
- condition1 = ' and bo.supplier=%(supplier)s '
+ condition = ' and bo.supplier=%(supplier)s'
if args.blanket_order:
- condition2 = ' and bo.name =%(blanket_order)s '
+ condition += ' and bo.name =%(blanket_order)s'
+ if args.transaction_date:
+ condition += ' and bo.to_date>=%(transaction_date)s'
+
blanket_order_details = frappe.db.sql('''
select boi.rate as blanket_order_rate, bo.name as blanket_order
from `tabBlanket Order` bo, `tabBlanket Order Item` boi
- where bo.to_date>=%(transaction_date)s and bo.company=%(company)s and boi.item_code=%(item_code)s
- and bo.docstatus=1 and bo.name = boi.parent {0} {1}
- '''.format(condition1, condition2), args, as_dict=True)
+ where bo.company=%(company)s and boi.item_code=%(item_code)s
+ and bo.docstatus=1 and bo.name = boi.parent {0}
+ '''.format(condition), args, as_dict=True)
+
blanket_order_details = blanket_order_details[0] if blanket_order_details else ''
return blanket_order_details