fix(item): add server-side guard for serial/batch items in make_opening_stock_entry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
khushi8112
2026-06-18 02:25:13 +05:30
parent c5b4a742b3
commit e57593fcf8

View File

@@ -1601,6 +1601,10 @@ def make_opening_stock_entry(
if not item.is_stock_item:
frappe.throw(_("Opening Stock can only be set for stock items."))
if item.has_serial_no or item.has_batch_no:
frappe.throw(
_("Opening Stock for serialised or batch items must be set via the Stock Reconciliation form.")
)
if item.stock_ledger_created():
frappe.throw(
_("Opening Stock cannot be created as stock transactions already exist for item {0}.").format(