Skip to content

Commit

Permalink
fix: delivery trip driver is only required on submit (#35876)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blaggacao authored Jun 27, 2023
1 parent 2d2f0f0 commit 742df8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions erpnext/stock/doctype/delivery_trip/delivery_trip.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
"fieldname": "driver",
"fieldtype": "Link",
"label": "Driver",
"options": "Driver",
"reqd": 1
"options": "Driver"
},
{
"fetch_from": "driver.full_name",
Expand Down Expand Up @@ -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": [
{
Expand Down Expand Up @@ -228,5 +228,6 @@
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "driver_name"
}
3 changes: 3 additions & 0 deletions erpnext/stock/doctype/delivery_trip/delivery_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 742df8a

Please sign in to comment.