fix: check if autoname is promt before setting __newname

This commit is contained in:
Shariq Ansari 2023-12-08 10:53:58 +05:30
parent a1bfdf28a2
commit 78cf0cd142

View file

@ -464,8 +464,11 @@ class Document(BaseDocument):
if self.flags.name_set and not force:
return
meta = self.meta or frappe.get_meta(self.doctype)
autoname = meta.autoname or ""
# If autoname has set as Prompt (name)
if self.get("__newname"):
if self.get("__newname") and autoname == "Prompt":
self.name = validate_name(self.doctype, self.get("__newname"))
self.flags.name_set = True
return