mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 08:35:00 +00:00
fix: limit condition to fetch serial nos
(cherry picked from commit da4b78491d)
# Conflicts:
# erpnext/stock/get_item_details.py
This commit is contained in:
committed by
Mergify
parent
06aded08ae
commit
425dcee5bf
@@ -241,6 +241,7 @@ class SerialandBatchBundle(Document):
|
||||
"check_serial_nos": True,
|
||||
"serial_nos": serial_nos,
|
||||
}
|
||||
|
||||
if self.voucher_type == "POS Invoice":
|
||||
kwargs["ignore_voucher_nos"] = [self.voucher_no]
|
||||
|
||||
@@ -1976,9 +1977,9 @@ def get_available_serial_nos(kwargs):
|
||||
|
||||
order_by = "creation"
|
||||
if kwargs.based_on == "LIFO":
|
||||
order_by = "creation desc"
|
||||
order_by = "creation"
|
||||
elif kwargs.based_on == "Expiry":
|
||||
order_by = "amc_expiry_date asc"
|
||||
order_by = "amc_expiry_date"
|
||||
|
||||
filters = {"item_code": kwargs.item_code}
|
||||
|
||||
@@ -2025,7 +2026,12 @@ def get_serial_nos_based_on_filters(filters, fields, order_by, kwargs):
|
||||
doctype = frappe.qb.DocType("Serial No")
|
||||
|
||||
order_by_column = getattr(doctype, order_by)
|
||||
query = frappe.qb.from_(doctype).orderby(order_by_column).limit(cint(kwargs.qty) or 10000000).for_update()
|
||||
query = frappe.qb.from_(doctype).limit(cint(kwargs.qty) or 10000000).for_update()
|
||||
|
||||
if kwargs.based_on == "LIFO":
|
||||
query = query.orderby(order_by_column, order=frappe.query_builder.Order.desc)
|
||||
else:
|
||||
query = query.orderby(order_by_column)
|
||||
|
||||
for key, value in filters.items():
|
||||
column = getattr(doctype, key)
|
||||
|
||||
@@ -203,7 +203,15 @@ def update_stock(ctx, out, doc=None):
|
||||
{
|
||||
"item_code": ctx.item_code,
|
||||
"warehouse": ctx.warehouse,
|
||||
<<<<<<< HEAD
|
||||
"based_on": frappe.db.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
=======
|
||||
"based_on": frappe.get_single_value("Stock Settings", "pick_serial_and_batch_based_on"),
|
||||
"sabb_voucher_no": doc.get("name") if doc else None,
|
||||
"sabb_voucher_detail_no": ctx.child_docname,
|
||||
"sabb_voucher_type": ctx.doctype,
|
||||
"pick_reserved_items": True,
|
||||
>>>>>>> da4b78491d (fix: limit condition to fetch serial nos)
|
||||
"qty": out.stock_qty,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user