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.
This commit is contained in:
David Arnold 2023-06-27 01:06:44 -05:00 committed by GitHub
parent 2d2f0f02d6
commit 742df8a25e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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):