diff --git a/frappe/email/doctype/notification/notification.py b/frappe/email/doctype/notification/notification.py index 6b4ee92043..77979f9735 100644 --- a/frappe/email/doctype/notification/notification.py +++ b/frappe/email/doctype/notification/notification.py @@ -435,8 +435,8 @@ def get_context(doc): def get_assignees(doc): assignees = [] assignees = frappe.get_all('ToDo', filters={'status': 'Open', 'reference_name': doc.name, - 'reference_type': doc.doctype}, fields=['owner']) + 'reference_type': doc.doctype}, fields=['allocated_to']) - recipients = [d.owner for d in assignees] + recipients = [d.allocated_to for d in assignees] return recipients diff --git a/frappe/model/document.py b/frappe/model/document.py index 4312378995..e519ab257b 100644 --- a/frappe/model/document.py +++ b/frappe/model/document.py @@ -1347,15 +1347,15 @@ class Document(BaseDocument): ), frappe.exceptions.InvalidDates) def get_assigned_users(self): - assignments = frappe.get_all('ToDo', + assigned_users = frappe.get_all('ToDo', fields=['allocated_to'], filters={ 'reference_type': self.doctype, 'reference_name': self.name, 'status': ('!=', 'Cancelled'), - }) + }, pluck='allocated_to') - users = set([assignment.owner for assignment in assignments]) + users = set(assigned_users) return users def add_tag(self, tag):