From 622bd10946f70a7141c72311d897e869b369e5df Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Mon, 1 Oct 2018 15:37:31 +0530 Subject: [PATCH 1/3] add date data [mandatory] --- erpnext/stock/doctype/delivery_trip/test_delivery_trip.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py index 4f7fcd8e58..f50f7e41af 100644 --- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py @@ -9,7 +9,7 @@ import erpnext import frappe from erpnext.stock.doctype.delivery_trip.delivery_trip import get_contact_and_address, notify_customers from erpnext.tests.utils import create_test_contact_and_address -from frappe.utils import add_days, now_datetime +from frappe.utils import add_days, now_datetime, nowdate class TestDeliveryTrip(unittest.TestCase): @@ -26,6 +26,7 @@ class TestDeliveryTrip(unittest.TestCase): delivery_trip = frappe.get_doc({ "doctype": "Delivery Trip", "company": erpnext.get_default_company(), + "date": add_days(nowdate(), 5), "departure_time": add_days(now_datetime(), 5), "driver": "DRIVER-00001", "vehicle": "JB 007", From 9e67b8ec4db17343d295f0d505582530948aefd7 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Mon, 1 Oct 2018 17:27:12 +0530 Subject: [PATCH 2/3] fix driver name selection --- erpnext/stock/doctype/delivery_trip/test_delivery_trip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py index f50f7e41af..fae03f8d9f 100644 --- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py @@ -28,7 +28,7 @@ class TestDeliveryTrip(unittest.TestCase): "company": erpnext.get_default_company(), "date": add_days(nowdate(), 5), "departure_time": add_days(now_datetime(), 5), - "driver": "DRIVER-00001", + "driver": frappe.db.get_value('Driver', {"full_name": "Newton Scmander"}), "vehicle": "JB 007", "delivery_stops": [{ "customer": "_Test Customer", From 6a5e6ed2fff6554a4d5032b3240833a783a11922 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Mon, 1 Oct 2018 17:28:42 +0530 Subject: [PATCH 3/3] delivery trip notification to customer fix --- erpnext/stock/doctype/delivery_trip/delivery_trip.py | 6 +++++- .../delivery_trip/dispatch_notification_template.html | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.py b/erpnext/stock/doctype/delivery_trip/delivery_trip.py index e932b1414f..424411e24a 100644 --- a/erpnext/stock/doctype/delivery_trip/delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.py @@ -10,7 +10,7 @@ import frappe from frappe import _ from frappe.contacts.doctype.address.address import get_address_display from frappe.model.document import Document -from frappe.utils import get_datetime, get_link_to_form +from frappe.utils import get_datetime, get_link_to_form, cstr class DeliveryTrip(Document): @@ -172,6 +172,10 @@ def notify_customers(delivery_trip): delivery_trip = frappe.get_doc("Delivery Trip", delivery_trip) context = delivery_trip.as_dict() + context.update({ + "departure_time": cstr(context.get("departure_time")), + "estimated_arrival": cstr(context.get("estimated_arrival")) + }) if delivery_trip.driver: context.update(frappe.db.get_value("Driver", delivery_trip.driver, "cell_number", as_dict=1)) diff --git a/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html b/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html index 90a5c50eb1..9c062bc34c 100644 --- a/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html +++ b/erpnext/stock/doctype/delivery_trip/dispatch_notification_template.html @@ -28,11 +28,11 @@ Departure Time - {{ cstr(departure_time) }} + {{ departure_time }} Estimated Arrival - {{ cstr(estimated_arrival) }} + {{ estimated_arrival }} Driver's Name