From f50efad863544917cccba6df1b76ef67ef1c968d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 4 Mar 2019 20:53:16 +0530 Subject: [PATCH] fix(assignment): apply unassign only if assigned --- frappe/automation/doctype/assignment_rule/assignment_rule.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frappe/automation/doctype/assignment_rule/assignment_rule.py b/frappe/automation/doctype/assignment_rule/assignment_rule.py index 58083434a8..3b3a96690c 100644 --- a/frappe/automation/doctype/assignment_rule/assignment_rule.py +++ b/frappe/automation/doctype/assignment_rule/assignment_rule.py @@ -16,12 +16,13 @@ class AssignmentRule(Document): frappe.cache().delete_value('assignment_rule') def apply(self, doc): - if not assign_to.get(doc) and self.safe_eval('assign_condition', doc): + assignments = assign_to.get(doc) + if not assignments and self.safe_eval('assign_condition', doc): self.do_assignment(doc) return True # try clearing - if self.unassign_condition: + if assignments and self.unassign_condition: return self.clear_assignment(doc) return False