Merge pull request #5883 from saurabh6790/maintenance_schedule_fix
[fix] report filter fix
This commit is contained in:
commit
548ea777a9
@ -71,9 +71,11 @@ def get_conditions(filters):
|
|||||||
conditions += " and item_code = '%s'" % frappe.db.escape(filters.get("item_code"), percent=False)
|
conditions += " and item_code = '%s'" % frappe.db.escape(filters.get("item_code"), percent=False)
|
||||||
|
|
||||||
if filters.get("warehouse"):
|
if filters.get("warehouse"):
|
||||||
lft, rgt = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"])
|
warehouse_details = frappe.db.get_value("Warehouse", filters.get("warehouse"), ["lft", "rgt"], as_dict=1)
|
||||||
|
if warehouse_details:
|
||||||
conditions += " and exists (select name from `tabWarehouse` wh \
|
conditions += " and exists (select name from `tabWarehouse` wh \
|
||||||
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(lft, rgt)
|
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(warehouse_details.lft,
|
||||||
|
warehouse_details.rgt)
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
|
@ -99,8 +99,10 @@ def get_opening_balance(filters, columns):
|
|||||||
return row
|
return row
|
||||||
|
|
||||||
def get_warehouse_condition(warehouse):
|
def get_warehouse_condition(warehouse):
|
||||||
lft, rgt = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"])
|
warehouse_details = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"], as_dict=1)
|
||||||
|
if warehouse_details:
|
||||||
return " exists (select name from `tabWarehouse` wh \
|
return " exists (select name from `tabWarehouse` wh \
|
||||||
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(lft, rgt)
|
where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(warehouse_details.lft,
|
||||||
|
warehouse_details.rgt)
|
||||||
|
|
||||||
|
return ''
|
||||||
|
@ -63,10 +63,12 @@ def get_bin_list(filters):
|
|||||||
conditions.append("item_code = '%s' "%filters.item_code)
|
conditions.append("item_code = '%s' "%filters.item_code)
|
||||||
|
|
||||||
if filters.warehouse:
|
if filters.warehouse:
|
||||||
lft, rgt = frappe.db.get_value("Warehouse", filters.warehouse, ["lft", "rgt"])
|
warehouse_details = frappe.db.get_value("Warehouse", filters.warehouse, ["lft", "rgt"], as_dict=1)
|
||||||
|
|
||||||
|
if warehouse_details:
|
||||||
conditions.append(" exists (select name from `tabWarehouse` wh \
|
conditions.append(" exists (select name from `tabWarehouse` wh \
|
||||||
where wh.lft >= %s and wh.rgt <= %s and bin.warehouse = wh.name)"%(lft, rgt))
|
where wh.lft >= %s and wh.rgt <= %s and bin.warehouse = wh.name)"%(warehouse_details.lft,
|
||||||
|
warehouse_details.rgt))
|
||||||
|
|
||||||
bin_list = frappe.db.sql("""select item_code, warehouse, actual_qty, planned_qty, indented_qty,
|
bin_list = frappe.db.sql("""select item_code, warehouse, actual_qty, planned_qty, indented_qty,
|
||||||
ordered_qty, reserved_qty, reserved_qty_for_production, projected_qty
|
ordered_qty, reserved_qty, reserved_qty_for_production, projected_qty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user