mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-23 20:16:40 +00:00
refactor(stock): remove dead get_batches() in batch.py
batch.get_batches(item_code, warehouse, ...) was added by #55647 and has no callers
anywhere in erpnext, frappe, or payments (not whitelisted, not referenced from JS/hooks).
It is also obsolete: it joins Stock Ledger Entry on `batch_no`, which the Serial and
Batch Bundle system no longer populates, so it returns nothing even on MariaDB. Its
query was additionally Postgres-invalid (GROUP BY batch_id with ORDER BY expiry_date/
creation -> GroupingError, since batch_id is not the primary key).
Remove the dead function (and its now-unused CurDate/Sum import) rather than fix a query
that nothing can reach. Live batch-quantity lookups go through get_batch_qty() /
get_auto_batch_nos(), which use the bundle model.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 345cbc97e1)
# Conflicts:
# erpnext/stock/doctype/batch/batch.py
This commit is contained in:
@@ -9,7 +9,6 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.naming import make_autoname, revert_series_if_last
|
||||
from frappe.query_builder.functions import CurDate, Sum
|
||||
from frappe.utils import cint, flt, get_link_to_form
|
||||
from frappe.utils.data import DateTimeLikeObject, add_days
|
||||
|
||||
@@ -385,6 +384,7 @@ def make_batch_bundle(
|
||||
)
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
def get_batches(item_code, warehouse, qty=1, throw=False, serial_no=None):
|
||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
||||
|
||||
@@ -428,6 +428,8 @@ def get_batches(item_code, warehouse, qty=1, throw=False, serial_no=None):
|
||||
return query.run(as_dict=True)
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> 345cbc97e1 (refactor(stock): remove dead get_batches() in batch.py)
|
||||
def validate_serial_no_with_batch(serial_nos, item_code):
|
||||
if frappe.get_cached_value("Serial No", serial_nos[0], "item_code") != item_code:
|
||||
frappe.throw(
|
||||
|
||||
Reference in New Issue
Block a user