Hello @komsel2228 i have been working on adding new column to stock balance report i’m having trouble populating the bin data to the newly added bin column can anyone help me on what i might be doing wrong.
Your help will be much appreciated.
Screenshot of output
def get_bin_list(filters):
conditions = []
if filters.item_code:
conditions.append("item_code = '%s' "%filters.item_code)
if filters.warehouse:
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 \
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,bin_label
from tabBin bin {conditions} order by item_code, warehouse
""".format(conditions=" where " + " and ".join(conditions) if conditions else ""), as_dict=1)
return bin_list