mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-31 23:33:43 +00:00
Merge pull request #58593 from frappe/mergify/bp/version-15-hotfix/pr-58325
fix(projects): check read permission on source in create_duplicate_project (backport #58325)
This commit is contained in:
@@ -590,12 +590,16 @@ def allow_to_make_project_update(project, time, frequency):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_duplicate_project(prev_doc, project_name):
|
||||
def create_duplicate_project(prev_doc: str | dict, project_name: str):
|
||||
"""Create duplicate project based on the old project"""
|
||||
import json
|
||||
|
||||
prev_doc = json.loads(prev_doc)
|
||||
|
||||
# prev_doc is caller-supplied, but the tasks below are read from the db by name
|
||||
if source_name := prev_doc.get("name"):
|
||||
frappe.has_permission("Project", "read", source_name, throw=True)
|
||||
|
||||
if project_name == prev_doc.get("name"):
|
||||
frappe.throw(_("Use a name that is different from previous project name"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user