fix: stock reconciliation shwoing incorrect current serial no and qty
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index d762917..2c6c953 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -293,9 +293,11 @@
row, key, value = data
row[key] = value
-def get_available_serial_nos(item_code, warehouse):
- return frappe.get_all("Serial No", filters = {'item_code': item_code,
- 'warehouse': warehouse, 'delivery_document_no': ''}) or []
+def get_available_serial_nos(args):
+ return frappe.db.sql(""" SELECT name from `tabSerial No`
+ WHERE item_code = %(item_code)s and warehouse = %(warehouse)s
+ and timestamp(purchase_date, purchase_time) <= timestamp(%(posting_date)s, %(posting_time)s)
+ """, args, as_dict=1)
def add_additional_uom_columns(columns, result, include_uom, conversion_factors):
if not include_uom or not conversion_factors: