hi, i want add new filter to the Process Payroll that will work similar to ‘branch’, ‘department’, designation’ filters
so what i did so far is:
1- added custom field to Employee with name emp_ab
2- added custom field to Process Payroll emp_ab
3 added emp_ab to the get_filter_condition function in …hr/doctype/process_payroll/process_payroll.ly
4- next step ???
any hint on this?, thanks
@PyJumper
PyJumper:
hi, i want add new filter to the Process Payroll that will work similar to ‘branch’, ‘department’, designation’ filters
you followed correct steps so far.
Can you share changes from process_payroll.py
you have to just add your filter condition into it.
def get_filter_condition(self):
self.check_mandatory()
cond = ''
for f in ['company', 'branch', 'department', 'designation', 'emp_ab']:
if self.get(f):
cond += " and t1." + f + " = '" + self.get(f).replace("'", "\'") + "'"
return cond
1 Like
thanks for reply
yes i just add ‘emp_ab’ to the list:
process_payroll.py
for f in [‘company’, ‘branch’, ‘department’, ‘designation’, ‘emp_ab’]:
but that did not work, i will try add the fields this time using doctype instead of customize form and see if that work.
PyJumper:
but that did not work,
you mean to say it is not filtering Employee List
as per emp_ab
or Is there any error?
Please check your query generated, especially cond
(Condition) part. Debug the query will get the answer.
emp_list = frappe.db.sql("""
select t1.name
from `tabEmployee` t1, `tabSalary Structure Employee` t2
where t1.docstatus!=2 and t1.name = t2.employee
%s """% cond, {"sal_struct": sal_struct})
return emp_list
Cross verify emp_ab
field value from both Employee
and Process Payroll
1 Like
yes its not filtering when i click ‘create salary slip’ button.
that field type is link to Project so i just want filter employees based on this
Make sure your field name on both Doctypes(Employee
and Process Payroll
) is emp_ab
. If yes it has to work.
1 Like