From 97ca190cb9cbd13682dfa2499fdddc76ec3a252e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 16:35:35 +0530 Subject: [PATCH] [assign to] function to clear assign to --- webnotes/widgets/form/assign_to.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webnotes/widgets/form/assign_to.py b/webnotes/widgets/form/assign_to.py index 37be5b4616..0f67174a54 100644 --- a/webnotes/widgets/form/assign_to.py +++ b/webnotes/widgets/form/assign_to.py @@ -100,7 +100,11 @@ def remove(doctype, name, assign_to): if res and res[0]: notify_assignment(res[0][0], res[0][1], res[0][2], res[0][3]) return get({"doctype": doctype, "name": name}) - + +def clear(doctype, name): + for assign_to in webnotes.conn.sql_list("""select owner from `tabToDo` + where reference_type=%(doctype)s and reference_name=%(name)s""", locals()): + remove(doctype, name, assign_to) def notify_assignment(assigned_by, owner, doc_type, doc_name, action='CLOSE', notify=0): """