From eee5c38911407189b4d8a67e868fec4df426db6c Mon Sep 17 00:00:00 2001 From: scmmishra Date: Tue, 16 Apr 2019 15:57:51 +0530 Subject: [PATCH] feat: Use controller for serial no. API --- erpnext/stock/doctype/serial_no/serial_no.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py index a421a209bdb..c6d1ed24b7b 100644 --- a/erpnext/stock/doctype/serial_no/serial_no.py +++ b/erpnext/stock/doctype/serial_no/serial_no.py @@ -462,15 +462,5 @@ def get_delivery_note_serial_no(item_code, qty, delivery_note): @frappe.whitelist() def auto_fetch_serial_number(qty, item_code, warehouse): - serial_numbers = frappe.db.sql_list("""select name from `tabSerial No` - where - item_code = %(item_code)s - and warehouse = %(warehouse)s - and delivery_document_no is null - and sales_invoice is null - limit {0}""".format(cint(qty)), { - 'item_code': item_code, - 'warehouse': warehouse - }) - + serial_numbers = frappe.get_list("Serial No", filters={"item_code": item_code, "warehouse": warehouse, "delivery_document_no": "", "sales_invoice": ""}, limit=qty, order_by="creation") return serial_numbers \ No newline at end of file