fix: validation to prevent Page names being the same as DocType names

This commit is contained in:
prssanna 2020-12-16 16:32:06 +05:30
parent 43184b82a1
commit f00dd46e3f

View file

@ -33,6 +33,11 @@ class Page(Document):
self.name += '-' + str(cnt)
def validate(self):
if frappe.db.get_value('DocType', self.name):
frappe.throw(
_("{} is the name of a DocType. DocType names cannot be the same as a Page name, please choose another name.").format(self.page_name)
)
if self.is_new() and not getattr(conf,'developer_mode', 0):
frappe.throw(_("Not in Developer Mode"))