fix: delivery trip driver is only required on submit (backport #35876) (#35893)

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.

(cherry picked from commit 742df8a25e)

Co-authored-by: David Arnold <david.arnold@iohk.io>
This commit is contained in:
mergify[bot]
2023-06-27 11:38:44 +05:30
committed by GitHub
parent 3ed42e180c
commit fc051d143c
2 changed files with 7 additions and 3 deletions

View File

@@ -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"
}

View File

@@ -24,6 +24,9 @@ class DeliveryTrip(Document):
)
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):