diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 27e0ab8209..d8e994d0da 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -1090,6 +1090,12 @@ def validate_series(dt, autoname=None, name=None): df.unique = 1 break + if autoname and autoname.startswith("format:"): + from frappe.model.naming import BRACED_PARAMS_HASH_PATTERN + + if len(BRACED_PARAMS_HASH_PATTERN.findall(autoname)) > 1: + frappe.throw(_("Only one set of {#} pattern is allowed in the format string")) + if ( autoname and (not autoname.startswith("field:"))