From 2737b08f0f8dce864f8641484ae30c0fdacf6e84 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 14 Jun 2018 18:07:22 +0530 Subject: [PATCH] blanket order related fixes --- .../doctype/blanket_order/blanket_order.json | 6 +++--- erpnext/stock/get_item_details.py | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.json b/erpnext/manufacturing/doctype/blanket_order/blanket_order.json index e2d26f4298..84e0816834 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 2eed4c9afc..6d891872be 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -749,19 +749,23 @@ def get_blanket_order_details(args): 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