refactor: replace json.loads with frappe.parse_json for assignees in remove_assignments function
(cherry picked from commit 5010cccc7158dca670530c564a4a4b01067e090f)
This commit is contained in:
parent
7e53e0f4e4
commit
8c3733a212
@ -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
|
||||
|
||||
@ -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.'))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user