feat: add login user to driver if available for notifications

This commit is contained in:
David Arnold
2024-01-30 10:20:26 +01:00
parent 2bdfdeeb9a
commit ff7e0eaba5
2 changed files with 19 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
{
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "naming_series:",
@@ -16,6 +17,7 @@
"employee",
"cell_number",
"address",
"user",
"license_details",
"license_number",
"column_break_8",
@@ -115,14 +117,23 @@
"fieldtype": "Link",
"label": "Address",
"options": "Address"
},
{
"fieldname": "user",
"fieldtype": "Link",
"in_list_view": 1,
"label": "User",
"options": "User",
"read_only_depends_on": "employee"
}
],
"icon": "fa fa-user",
"modified": "2022-06-28 10:29:14.151380",
"links": [],
"modified": "2024-01-23 21:47:12.507540",
"modified_by": "Administrator",
"module": "Setup",
"name": "Driver",
"name_case": "Title Case",
"naming_rule": "By \"Naming Series\" field",
"owner": "Administrator",
"permissions": [
{
@@ -180,6 +191,7 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "full_name",
"track_changes": 1
}
}

View File

@@ -1,7 +1,7 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
@@ -31,4 +31,6 @@ class Driver(Document):
transporter: DF.Link | None
# end: auto-generated types
pass
def validate(self):
if self.employee:
self.user = frappe.get_value("Employee", self.employee, "user_id")