Made join_table query optional based on item group filter
This commit is contained in:
parent
41bf1ba7b3
commit
e2fef16d78
@ -84,12 +84,16 @@ def get_conditions(filters):
|
||||
|
||||
def get_stock_ledger_entries(filters):
|
||||
conditions = get_conditions(filters)
|
||||
|
||||
join_table_query = ""
|
||||
if filters.get("item_group"):
|
||||
join_table_query = "inner join `tabItem` item on item.name = sle.item_code"
|
||||
|
||||
return frappe.db.sql("""select sle.item_code, warehouse, sle.posting_date, sle.actual_qty, sle.valuation_rate,
|
||||
sle.company, sle.voucher_type, sle.qty_after_transaction, sle.stock_value_difference
|
||||
from `tabStock Ledger Entry` sle force index (posting_sort_index)
|
||||
inner join `tabItem` item on item.name = sle.item_code
|
||||
from `tabStock Ledger Entry` sle force index (posting_sort_index) %s
|
||||
where sle.docstatus < 2 %s order by sle.posting_date, sle.posting_time, sle.name""" %
|
||||
conditions, as_dict=1)
|
||||
(join_table_query, conditions), as_dict=1)
|
||||
|
||||
def get_item_warehouse_map(filters):
|
||||
iwb_map = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user