2018-09-30 16:08:47 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import frappe
|
|
|
|
from frappe import _
|
|
|
|
|
|
|
|
|
|
|
|
def execute():
|
|
|
|
frappe.reload_doc("email", "doctype", "email_template")
|
|
|
|
frappe.reload_doc("stock", "doctype", "delivery_settings")
|
|
|
|
|
|
|
|
if not frappe.db.exists("Email Template", _("Dispatch Notification")):
|
|
|
|
base_path = frappe.get_app_path("erpnext", "stock", "doctype")
|
|
|
|
response = frappe.read_file(
|
|
|
|
os.path.join(base_path, "delivery_trip/dispatch_notification_template.html")
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2018-09-30 16:08:47 +00:00
|
|
|
|
|
|
|
frappe.get_doc(
|
|
|
|
{
|
|
|
|
"doctype": "Email Template",
|
|
|
|
"name": _("Dispatch Notification"),
|
|
|
|
"response": response,
|
|
|
|
"subject": _("Your order is out for delivery!"),
|
|
|
|
"owner": frappe.session.user,
|
|
|
|
}
|
|
|
|
).insert(ignore_permissions=True)
|
|
|
|
|
|
|
|
delivery_settings = frappe.get_doc("Delivery Settings")
|
|
|
|
delivery_settings.dispatch_template = _("Dispatch Notification")
|
2021-12-24 11:50:23 +00:00
|
|
|
delivery_settings.flags.ignore_links = True
|
2018-09-30 16:08:47 +00:00
|
|
|
delivery_settings.save()
|