refactor: replace json.loads with frappe.parse_json for assignees in remove_assignments function

This commit is contained in:
Shariq Ansari 2025-08-01 13:03:14 +05:30
parent aeb3f150c5
commit 5010cccc71
2 changed files with 2 additions and 9 deletions

View File

@ -663,7 +663,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

View File

@ -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.'))
}