fix: batch/serial should use parent's posting datetime for naming (#54206)

This commit is contained in:
Mihir Kandoi
2026-04-11 00:29:16 +05:30
committed by GitHub
parent 1dcfd9174f
commit 2f5fa3b207

View File

@@ -1615,6 +1615,10 @@ def parse_naming_series_variable(doc, variable):
else:
data = {"YY": "%y", "YYYY": "%Y", "MM": "%m", "DD": "%d", "JJJ": "%j"}
if doc and doc.doctype in ["Batch", "Serial No"] and doc.reference_doctype and doc.reference_name:
doc = frappe.get_doc(doc.reference_doctype, doc.reference_name)
date = (
(
getdate(doc.get("posting_date") or doc.get("transaction_date") or doc.get("posting_datetime"))