def trigger_call_popup(self): scheduled_employees = get_scheduled_employees_for_popup(self.medium) employee_emails = get_employees_with_number(self.to) # check if employees with matched number are scheduled to receive popup emails = set(scheduled_employees).intersection(employee_emails) # # if no employee found with matching phone number then show popup to scheduled employees # emails = emails or scheduled_employees if employee_emails for email in emails: frappe.publish_realtime('show_call_popup', self, user=email)
def trigger_call_popup(self): if self.is_incoming_call(): scheduled_employees = get_scheduled_employees_for_popup(self.medium) employee_emails = get_employees_with_number(self.to) # check if employees with matched number are scheduled to receive popup emails = set(scheduled_employees).intersection(employee_emails) if frappe.conf.developer_mode: self.add_comment(text=f""" Scheduled Employees: {scheduled_employees} Matching Employee: {employee_emails} Show Popup To: {emails} """) if employee_emails and not emails: self.add_comment(text=_("No employee was scheduled for call popup")) for email in emails: frappe.publish_realtime('show_call_popup', self, user=email)