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

This commit is contained in:
mergify[bot]
2026-04-11 05:06:40 +00:00
committed by GitHub
parent 7d8f59eb0a
commit 3bdac5c30a

View File

@@ -1603,6 +1603,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"))