From 86da17d5d9ae71272116c67876ce831d6b46f159 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 6 Dec 2013 13:23:31 +0530 Subject: [PATCH] [minor] removed mandatory validation in server side --- stock/report/stock_ageing/stock_ageing.py | 6 ------ .../stock_projected_qty/stock_projected_qty.py | 17 +++-------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/stock/report/stock_ageing/stock_ageing.py b/stock/report/stock_ageing/stock_ageing.py index f688ed96efd..fa052050ca1 100644 --- a/stock/report/stock_ageing/stock_ageing.py +++ b/stock/report/stock_ageing/stock_ageing.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals import webnotes from webnotes.utils import date_diff -from webnotes import _ def execute(filters=None): @@ -64,11 +63,6 @@ def get_fifo_queue(filters): return item_details def get_stock_ledger_entries(filters): - if not filters.get("company"): - webnotes.throw(_("Company is mandatory")) - if not filters.get("to_date"): - webnotes.throw(_("To Date is mandatory")) - return webnotes.conn.sql("""select item.name, item.item_name, brand, description, item.stock_uom, actual_qty, posting_date from `tabStock Ledger Entry` sle, diff --git a/stock/report/stock_projected_qty/stock_projected_qty.py b/stock/report/stock_projected_qty/stock_projected_qty.py index 126cc2c34e3..232c744c874 100644 --- a/stock/report/stock_projected_qty/stock_projected_qty.py +++ b/stock/report/stock_projected_qty/stock_projected_qty.py @@ -3,19 +3,17 @@ from __future__ import unicode_literals import webnotes -from webnotes import _ def execute(filters=None): columns = get_columns() - if not filters.get("company"): - webnotes.throw(_("Company is mandatory")) data = webnotes.conn.sql("""select item.name, item.item_name, description, brand, warehouse, item.stock_uom, actual_qty, planned_qty, indented_qty, ordered_qty, reserved_qty, projected_qty, item.re_order_level, item.re_order_qty from `tabBin` bin, - (select name, company from tabWarehouse {warehouse_conditions}) wh, + (select name, company from tabWarehouse + where company=%(company)s {warehouse_conditions}) wh, (select name, item_name, description, stock_uom, brand, re_order_level, re_order_qty from `tabItem` {item_conditions}) item where item_code = item.name and warehouse = wh.name @@ -42,13 +40,4 @@ def get_item_conditions(filters): return "where {}".format(" and ".join(conditions)) if conditions else "" def get_warehouse_conditions(filters): - conditions = [] - if not filters.get("company"): - webnotes.throw(_("Company is mandatory")) - else: - conditions.append("company=%(company)s") - - if filters.get("warehouse"): - conditions.append("name=%(warehouse)s") - - return "where {}".format(" and ".join(conditions)) if conditions else "" \ No newline at end of file + return " and name=%(warehouse)s" if filters.get("warehouse") else "" \ No newline at end of file