Skip to content

Commit

Permalink
perf: index most queried fields in Leave Ledger Entry
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal committed Nov 17, 2023
1 parent 8e516b1 commit b86cdaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hrms/hr/doctype/leave_ledger_entry/leave_ledger_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Employee",
"options": "Employee"
"options": "Employee",
"search_index": 1
},
{
"fetch_from": "employee.employee_name",
Expand Down Expand Up @@ -57,13 +58,15 @@
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Transaction Type",
"options": "DocType"
"options": "DocType",
"search_index": 1
},
{
"fieldname": "transaction_name",
"fieldtype": "Dynamic Link",
"label": "Transaction Name",
"options": "transaction_type"
"options": "transaction_type",
"search_index": 1
},
{
"fieldname": "leaves",
Expand Down Expand Up @@ -123,7 +126,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-01-04 18:47:45.146652",
"modified": "2023-11-17 12:36:36.963697",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Ledger Entry",
Expand Down Expand Up @@ -186,5 +189,6 @@
],
"sort_field": "modified",
"sort_order": "ASC",
"states": [],
"title_field": "employee"
}
4 changes: 4 additions & 0 deletions hrms/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,7 @@ def expire_carried_forward_allocation(allocation):
to_date=allocation.to_date,
)
create_leave_ledger_entry(allocation, args)


def on_doctype_update():
frappe.db.add_index("Leave Ledger Entry", ["transaction_type", "transaction_name"])

0 comments on commit b86cdaf

Please sign in to comment.