Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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