'Clear communications where email account is linked'

def on_trash(self):

    from frappe.core.doctype.user.user import remove_user_email_inbox
    frappe.db.sql(u"update    `tabCommunication`    set    email_account=''    where    email_account=%s", self.name)
    remove_user_email_inbox(email_account=self.name)
