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
(cherry picked from commit 5911934)

# Conflicts:
#	erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.json
#	erpnext/patches.txt
  • Loading branch information
khushi8112 authored and mergify[bot] committed Oct 21, 2024
1 parent f51c511 commit a3b8f97
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
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,26 @@
"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": [],
<<<<<<< HEAD
"modified": "2021-01-22 12:33:45.888124",
=======
"modified": "2024-09-24 15:12:37.497853",
>>>>>>> 5911934dc7 (feat: added assignee email field in asset maintenance log)
"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
5 changes: 5 additions & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,4 +377,9 @@ erpnext.patches.v15_0.drop_index_posting_datetime_from_sle
erpnext.patches.v15_0.add_disassembly_order_stock_entry_type #1
erpnext.patches.v15_0.set_standard_stock_entry_type
erpnext.patches.v15_0.link_purchase_item_to_asset_doc
<<<<<<< HEAD
erpnext.patches.v14_0.update_currency_exchange_settings_for_frankfurter
=======
erpnext.patches.v15_0.migrate_to_utm_analytics
erpnext.patches.v15_0.update_task_assignee_email_field_in_asset_maintenance_log
>>>>>>> 5911934dc7 (feat: added 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 a3b8f97

Please sign in to comment.