From 8c3733a212791b7989bb69a9da8bee482b2eebf1 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 1 Aug 2025 13:03:14 +0530 Subject: [PATCH] refactor: replace json.loads with frappe.parse_json for assignees in remove_assignments function (cherry picked from commit 5010cccc7158dca670530c564a4a4b01067e090f) --- crm/api/doc.py | 2 +- frontend/src/components/AssignToBody.vue | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/crm/api/doc.py b/crm/api/doc.py index 1369a952..4c326b2f 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -662,7 +662,7 @@ def get_fields_meta(doctype, restricted_fieldtypes=None, as_array=False, only_re @frappe.whitelist() def remove_assignments(doctype, name, assignees, ignore_permissions=False): - assignees = json.loads(assignees) + assignees = frappe.parse_json(assignees) if not assignees: return diff --git a/frontend/src/components/AssignToBody.vue b/frontend/src/components/AssignToBody.vue index dc71dbea..223d1fb4 100644 --- a/frontend/src/components/AssignToBody.vue +++ b/frontend/src/components/AssignToBody.vue @@ -99,7 +99,6 @@ const oldAssignees = ref([]) const assignToMe = ref(false) const error = ref('') -const ownerRemoved = ref(false) const { users, getUser } = usersStore() @@ -143,7 +142,6 @@ watch(assignToMe, (val) => { watch( () => props.open, (val) => { - ownerRemoved.value = false if (val) { oldAssignees.value = [...(assignees.value || [])] @@ -170,15 +168,10 @@ async function updateAssignees() { .map((assignee) => assignee.name) if (removedAssignees.length) { - if (!ownerRemoved.value && removedAssignees.includes(owner.value)) { - ownerRemoved.value = true - return - } - await call('crm.api.doc.remove_assignments', { doctype: props.doctype, name: props.doc.name, - assignees: JSON.stringify(removedAssignees), + assignees: removedAssignees, }) toast.success(__('Assignees removed successfully.')) }