-
Notifications
You must be signed in to change notification settings - Fork 551
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
feat: Salary Withholding #1726
base: develop
Are you sure you want to change the base?
feat: Salary Withholding #1726
Conversation
vinyselopal
commented
Apr 30, 2024
0d365b9
to
3827d73
Compare
…on in Employee form
…e details from backend
3827d73
to
76ed868
Compare
"date_of_joining": frappe.get_value("Employee", employee, "date_of_joining"), | ||
"relieving_date": frappe.get_value("Employee", employee, "relieving_date"), | ||
"employee_name": frappe.get_value("Employee", employee, "employee_name"), | ||
"resignation_letter_date": frappe.get_value("Employee", employee, "resignation_letter_date"), | ||
"notice_number_of_days": frappe.get_value("Employee", employee, "notice_number_of_days"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will lead to 5 DB calls from a single table. All of this should be fetched in a single query. You can just set fetch from properties for these fields and eliminate this code completely
@@ -1158,6 +1158,7 @@ def get_filtered_employees( | |||
query = set_fields_to_select(query, fields) | |||
query = set_searchfield(query, searchfield, search_string, qb_object=Employee) | |||
query = set_filter_conditions(query, filters, qb_object=Employee) | |||
salary_withholding_documents = frappe.db.get_all("Salary Withholding") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The date filtering for fetching salary withholding documents should happen here itself instead of fetching all records
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the date filtering should happen in this get_all
query based on dates instead of looping and filtering in python later.
Not "join" in the main query since this won't be a widely used feature initially
employee = frappe.db.get_all( | ||
"Employee", | ||
filters={"name": employee}, | ||
fields=[ | ||
"date_of_joining", | ||
"relieving_date", | ||
"employee_name", | ||
"resignation_letter_date", | ||
"notice_number_of_days", | ||
], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
employee = frappe.db.get_all( | |
"Employee", | |
filters={"name": employee}, | |
fields=[ | |
"date_of_joining", | |
"relieving_date", | |
"employee_name", | |
"resignation_letter_date", | |
"notice_number_of_days", | |
], | |
) | |
employee = frappe.db.get_value( | |
"Employee", | |
employee, | |
fields=[ | |
"date_of_joining", | |
"relieving_date", | |
"employee_name", | |
"resignation_letter_date", | |
"notice_number_of_days", | |
], | |
as_dict=True, | |
) |
get_all
is for fetching multiple records. We just need a single record here and also know the name of the record so get_value
is the correct way
This will eliminate employee[0].date_of_joining too because this will directly return the dictionary not a list of dictionaries
…d Number of Withheld Cycles field
@@ -725,6 +725,7 @@ | |||
"oldfieldtype": "Section Break" | |||
}, | |||
{ | |||
"default": "Released", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a status field in Salary Slip. Use the same?
… to payroll Entry
… field to doctypes
a33191a
to
97a425b
Compare
…e statuses on cancel