Browse Source

fix: ignore route conflict validation while renaming desk page to workspace

version-14
prssanna 4 years ago
parent
commit
be634c99e1
3 changed files with 6 additions and 1 deletions
  1. +1
    -1
      frappe/core/doctype/doctype/doctype.py
  2. +3
    -0
      frappe/desk/utils.py
  3. +2
    -0
      frappe/patches/v13_0/rename_desk_page_to_workspace.py

+ 1
- 1
frappe/core/doctype/doctype/doctype.py View File

@@ -664,7 +664,7 @@ class DocType(Document):
if not re.match("^(?![\W])[^\d_\s][\w ]+$", name, **flags):
frappe.throw(_("DocType's name should start with a letter and it can only consist of letters, numbers, spaces and underscores"), frappe.NameError)

validate_route_conflict(self.doctype, self.name)
validate_route_conflict(self.doctype, self.name)

def validate_links_table_fieldnames(meta):
"""Validate fieldnames in Links table"""


+ 3
- 0
frappe/desk/utils.py View File

@@ -7,6 +7,9 @@ def validate_route_conflict(doctype, name):
'''
Raises exception if name clashes with routes from other documents for /app routing
'''
if frappe.flags.ignore_route_conflict_validation:
return

all_names = []
for _doctype in ['Page', 'Workspace', 'DocType']:
all_names.extend([slug(d) for d in frappe.get_all(_doctype, pluck='name') if (doctype != _doctype and d != name)])


+ 2
- 0
frappe/patches/v13_0/rename_desk_page_to_workspace.py View File

@@ -7,7 +7,9 @@ def execute():
# this patch was not added initially, so this page might still exist
frappe.delete_doc('DocType', 'Desk Page')
else:
frappe.flags.ignore_route_conflict_validation = True
rename_doc('DocType', 'Desk Page', 'Workspace')
frappe.flags.ignore_route_conflict_validation = False

rename_doc('DocType', 'Desk Chart', 'Workspace Chart', ignore_if_exists=True)
rename_doc('DocType', 'Desk Shortcut', 'Workspace Shortcut', ignore_if_exists=True)


Loading…
Cancel
Save