Skip to content

Commit

Permalink
fix: unassign and assign if task user is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Sep 23, 2024
1 parent 5b28657 commit d479315
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crm/fcrm/doctype/crm_task/crm_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ class CRMTask(Document):
def after_insert(self):
self.assign_to()

def validate(self):
if self.is_new() or not self.assigned_to:
return

if self.get_doc_before_save().assigned_to != self.assigned_to:
self.unassign_from_previous_user(self.get_doc_before_save().assigned_to)
self.assign_to()

def unassign_from_previous_user(self, user):
unassign(self.doctype, self.name, user)

def assign_to(self):
if self.assigned_to:
assign({
Expand Down

0 comments on commit d479315

Please sign in to comment.