Merge pull request #15551 from Zlash65/minor-fix
[Minor] Delivery trip test fix
This commit is contained in:
commit
5a2aced586
@ -10,7 +10,7 @@ import frappe
|
|||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.contacts.doctype.address.address import get_address_display
|
from frappe.contacts.doctype.address.address import get_address_display
|
||||||
from frappe.model.document import Document
|
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):
|
class DeliveryTrip(Document):
|
||||||
@ -172,6 +172,10 @@ def notify_customers(delivery_trip):
|
|||||||
delivery_trip = frappe.get_doc("Delivery Trip", delivery_trip)
|
delivery_trip = frappe.get_doc("Delivery Trip", delivery_trip)
|
||||||
|
|
||||||
context = delivery_trip.as_dict()
|
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:
|
if delivery_trip.driver:
|
||||||
context.update(frappe.db.get_value("Driver", delivery_trip.driver, "cell_number", as_dict=1))
|
context.update(frappe.db.get_value("Driver", delivery_trip.driver, "cell_number", as_dict=1))
|
||||||
|
|||||||
@ -28,11 +28,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Departure Time</td>
|
<td>Departure Time</td>
|
||||||
<td>{{ cstr(departure_time) }}</td>
|
<td>{{ departure_time }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Estimated Arrival</td>
|
<td>Estimated Arrival</td>
|
||||||
<td>{{ cstr(estimated_arrival) }}</td>
|
<td>{{ estimated_arrival }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Driver's Name</td>
|
<td>Driver's Name</td>
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import erpnext
|
|||||||
import frappe
|
import frappe
|
||||||
from erpnext.stock.doctype.delivery_trip.delivery_trip import get_contact_and_address, notify_customers
|
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 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):
|
class TestDeliveryTrip(unittest.TestCase):
|
||||||
@ -26,8 +26,9 @@ class TestDeliveryTrip(unittest.TestCase):
|
|||||||
delivery_trip = frappe.get_doc({
|
delivery_trip = frappe.get_doc({
|
||||||
"doctype": "Delivery Trip",
|
"doctype": "Delivery Trip",
|
||||||
"company": erpnext.get_default_company(),
|
"company": erpnext.get_default_company(),
|
||||||
|
"date": add_days(nowdate(), 5),
|
||||||
"departure_time": add_days(now_datetime(), 5),
|
"departure_time": add_days(now_datetime(), 5),
|
||||||
"driver": "DRIVER-00001",
|
"driver": frappe.db.get_value('Driver', {"full_name": "Newton Scmander"}),
|
||||||
"vehicle": "JB 007",
|
"vehicle": "JB 007",
|
||||||
"delivery_stops": [{
|
"delivery_stops": [{
|
||||||
"customer": "_Test Customer",
|
"customer": "_Test Customer",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user