@Pawan i am writing in custom script and want to get that method using hooks.py,is it right process?
Is it right code?
def Arrears_info(self):
data = frappe.db.sql(“”“select employee, arrears_amount from tabArrears
“””,self.employee,as_dict=“True”);
print “---------------DATA in arrears--------------------”,data
a = frappe.get_doc(“Salary Slip”,data)
frappe.db.set_value(“Salary Slip”,a.arrears_amount,“Arrears”,“”)
Can you please explain what exactly you need to do?
But basically I do not see that you need to use hooks.py, what you need is to have script that will be triggered when selecting for example the employee, this script should do the work and return the value to be displayed.
But you need to think what will happen if you are using Payroll Process, it will work? You need to test it also from Payroll Process as well as testing from Salary Slip.
Regards
Bilal
@bghayad you are right…for what i am thinking,while going for a payroll process if an employee has ARREARS the amount will display to the particle employee otherwise it will display zero