blanket order related fixes

This commit is contained in:
Nabin Hait 2018-06-14 18:07:22 +05:30
parent 0b9b8d6826
commit 2737b08f0f
2 changed files with 14 additions and 10 deletions

View File

@ -274,7 +274,7 @@
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0, "translatable": 0,
@ -306,7 +306,7 @@
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0, "remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0, "translatable": 0,
@ -452,7 +452,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-06-04 06:36:36.933751", "modified": "2018-06-14 18:06:48.009635",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Blanket Order", "name": "Blanket Order",

View File

@ -749,19 +749,23 @@ def get_blanket_order_details(args):
args = frappe._dict(json.loads(args)) args = frappe._dict(json.loads(args))
blanket_order_details = None blanket_order_details = None
condition1, condition2 = ' ', ' ' condition = ''
if args.item_code: if args.item_code:
if args.customer and args.doctype == "Sales Order": 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": elif args.supplier and args.doctype == "Purchase Order":
condition1 = ' and bo.supplier=%(supplier)s ' condition = ' and bo.supplier=%(supplier)s'
if args.blanket_order: 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(''' blanket_order_details = frappe.db.sql('''
select boi.rate as blanket_order_rate, bo.name as blanket_order select boi.rate as blanket_order_rate, bo.name as blanket_order
from `tabBlanket Order` bo, `tabBlanket Order Item` boi 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 where bo.company=%(company)s and boi.item_code=%(item_code)s
and bo.docstatus=1 and bo.name = boi.parent {0} {1} and bo.docstatus=1 and bo.name = boi.parent {0}
'''.format(condition1, condition2), args, as_dict=True) '''.format(condition), args, as_dict=True)
blanket_order_details = blanket_order_details[0] if blanket_order_details else '' blanket_order_details = blanket_order_details[0] if blanket_order_details else ''
return blanket_order_details return blanket_order_details