From 742df8a25e6249e67eb755e449bdbe969e052b7e Mon Sep 17 00:00:00 2001 From: David Arnold Date: Tue, 27 Jun 2023 01:06:44 -0500 Subject: [PATCH] fix: delivery trip driver is only required on submit (#35876) This allows drafting trips and stops without yet deciding on the assignable driver which, in real life, may well be decided on after preparing and planning the trip. --- erpnext/stock/doctype/delivery_trip/delivery_trip.json | 7 ++++--- erpnext/stock/doctype/delivery_trip/delivery_trip.py | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.json b/erpnext/stock/doctype/delivery_trip/delivery_trip.json index 11b71c207611..9d8fe46e8ca6 100644 --- a/erpnext/stock/doctype/delivery_trip/delivery_trip.json +++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.json @@ -66,8 +66,7 @@ "fieldname": "driver", "fieldtype": "Link", "label": "Driver", - "options": "Driver", - "reqd": 1 + "options": "Driver" }, { "fetch_from": "driver.full_name", @@ -189,10 +188,11 @@ ], "is_submittable": 1, "links": [], - "modified": "2021-04-30 21:21:36.610142", + "modified": "2023-06-27 11:22:27.927637", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Trip", + "naming_rule": "By \"Naming Series\" field", "owner": "Administrator", "permissions": [ { @@ -228,5 +228,6 @@ ], "sort_field": "modified", "sort_order": "DESC", + "states": [], "title_field": "driver_name" } \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.py b/erpnext/stock/doctype/delivery_trip/delivery_trip.py index 1febbded52b3..af2f4113e1e7 100644 --- a/erpnext/stock/doctype/delivery_trip/delivery_trip.py +++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.py @@ -24,6 +24,9 @@ def __init__(self, *args, **kwargs): ) def validate(self): + if self._action == "submit" and not self.driver: + frappe.throw(_("A driver must be set to submit.")) + self.validate_stop_addresses() def on_submit(self):