Skip to content

Commit

Permalink
feat: added assignee email field in asset maintenance log
Browse files Browse the repository at this point in the history
  • Loading branch information
khushi8112 committed Sep 24, 2024
1 parent c671a6c commit 5911934
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def update_maintenance_log(asset_maintenance, item_code, item_name, task):
"has_certificate": task.certificate_required,
"description": task.description,
"assign_to_name": task.assign_to_name,
"task_assignee_email": task.assign_to,
"periodicity": str(task.periodicity),
"maintenance_type": task.maintenance_type,
"due_date": task.next_due_date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"column_break_6",
"maintenance_status",
"assign_to_name",
"task_assignee_email",
"due_date",
"completion_date",
"description",
Expand Down Expand Up @@ -168,15 +169,22 @@
"in_preview": 1,
"label": "Task Name",
"read_only": 1
},
{
"fieldname": "task_assignee_email",
"fieldtype": "Data",
"label": "Task Assignee Email",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-03-27 13:06:34.654633",
"modified": "2024-09-24 15:12:37.497853",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Maintenance Log",
"naming_rule": "By \"Naming Series\" field",
"owner": "Administrator",
"permissions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class AssetMaintenanceLog(Document):
naming_series: DF.Literal["ACC-AML-.YYYY.-"]
periodicity: DF.Data | None
task: DF.Link | None
task_assignee_email: DF.Data | None
task_name: DF.Data | None
# end: auto-generated types

Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,4 @@ erpnext.patches.v15_0.set_standard_stock_entry_type
erpnext.patches.v15_0.set_difference_amount_in_asset_value_adjustment
erpnext.patches.v15_0.link_purchase_item_to_asset_doc
erpnext.patches.v15_0.migrate_to_utm_analytics
erpnext.patches.v15_0.update_task_assignee_email_field_in_asset_maintenance_log
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import frappe
from frappe.query_builder import DocType


def execute():
if frappe.db.has_column("Asset Maintenance Log", "task_assignee_email"):
asset_maintenance_log = DocType("Asset Maintenance Log")
asset_maintenance_task = DocType("Asset Maintenance Task")
try:
(
frappe.qb.update(asset_maintenance_log)
.set(asset_maintenance_log.task_assignee_email, asset_maintenance_task.assign_to)
.join(asset_maintenance_task)
.on(asset_maintenance_log.task == asset_maintenance_task.name)
.run()
)
except Exception:
frappe.log_error("Failed to update Task Assignee Email Field.")

0 comments on commit 5911934

Please sign in to comment.