def send_email(): from webnotes.utils.email_lib import sendmail_to_system_managers global cancelled, uncancelled uncancelled = "we have undone the cancellation of the following Stock Entries through a patch:\n" + \ "\n".join(uncancelled) if uncancelled else "" cancelled = "and cancelled the following Stock Entries:\n" + "\n".join(cancelled) \ if cancelled else "" subject = "[Owrang] [Important] Cancellation undone for some Stock Entries" content = """Dear System Manager, An error got introduced into the code that cleared the item table in a Stock Entry associated to a Production Order. To undo its effect, %s %s You will have to edit them again. Sorry for the inconvenience this has caused. Regards, Team Owrang.""" % (uncancelled, cancelled) # print subject, content sendmail_to_system_managers(subject, content)
def send_email(): from webnotes.utils.email_lib import sendmail_to_system_managers global cancelled, uncancelled uncancelled = "we have undone the cancellation of the following Stock Entries through a patch:\n" + \ "\n".join(uncancelled) if uncancelled else "" cancelled = "and cancelled the following Stock Entries:\n" + "\n".join(cancelled) \ if cancelled else "" subject = "[ERPNext] [Important] Cancellation undone for some Stock Entries" content = """Dear System Manager, An error got introduced into the code that cleared the item table in a Stock Entry associated to a Production Order. To undo its effect, %s %s You will have to edit them again. Sorry for the inconvenience this has caused. Regards, Team ERPNext.""" % (uncancelled, cancelled) # print subject, content sendmail_to_system_managers(subject, content)
def report_errors(): from webnotes.utils.email_lib import sendmail_to_system_managers from startup import get_url errors = [("""<p>Time: %(modified)s</p> <pre><code>%(error)s</code></pre>""" % d) for d in webnotes.conn.sql("""select modified, error from `tabScheduler Log` where DATEDIFF(NOW(), modified) < 1 limit 10""", as_dict=True)] if errors: sendmail_to_system_managers("ERPNext Scheduler Failure Report", (""" <p>Dear System Managers,</p> <p>Reporting ERPNext failed scheduler events for the day (max 10):</p> <p>URL: <a href="%(url)s" target="_blank">%(url)s</a></p><hr>""" % {"url":get_url()}) + "<hr>".join(errors))
def report_errors(): from webnotes.utils.email_lib import sendmail_to_system_managers from webnotes.utils import get_url errors = [("""<p>Time: %(modified)s</p> <pre><code>%(error)s</code></pre>""" % d) for d in webnotes.conn.sql("""select modified, error from `tabScheduler Log` where DATEDIFF(NOW(), modified) < 1 and error not like '%%[Errno 110] Connection timed out%%' limit 10""", as_dict=True)] if errors: sendmail_to_system_managers("Owrang Scheduler Failure Report", (""" <p>Dear System Managers,</p> <p>Reporting Owrang failed scheduler events for the day (max 10):</p> <p>URL: <a href="%(url)s" target="_blank">%(url)s</a></p><hr>""" % {"url":get_url()}) + "<hr>".join(errors))