[minor] removed mandatory validation in server side

This commit is contained in:
Nabin Hait 2013-12-06 13:23:31 +05:30
parent ce2dfadfbd
commit 86da17d5d9
2 changed files with 3 additions and 20 deletions

View File

@ -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,

View File

@ -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 ""
return " and name=%(warehouse)s" if filters.get("warehouse") else ""