Salary Component based on employee attendance

Would you please advise me how to use salary component (if Earning or Deduction) when creating salary structure, such that ‘condition’ used in this salary component will depend on fields in ‘Attendance’ of the employee ? In ‘Condition and Formula Help’ mentioned only that we can use fields from ‘employee details’ and ‘Salary Slip’ !! I want to use fields from ‘employee attendance’ also.
To clarify more my case, there is salary component earned if the employee attend earlier than specific hour. And there is another salary component deducted if the employee attend later than specific hour.
Thanks for help.

Hi @h_hadidy! This feature is not yet automated except if you would manually add in the component base on the condition. But, you can always add in some customization through scripting. For more info on custom scripts, see here. Or you can always send in a feature request for this on GitHub

Many thanks @creamdory .

1 Like

Would be great if someone could share an example of a script collecting attendance data and passing it to a salary component.

I agree.

/// rant on

But at the same time think in order to make this really an effective tool the Attnedance per se needs to become much more flexible, just like the Timesheets.

Like "Punch in Time" - "Punch Out Time" = Attendance Time (hrs:min) rather then just yes/no to full or at best half days (which does not reflect reality in my eyes)

/// rant off

For my own purpose I extended Attendance DocType to be similar to Timesheet, i.e. having a list of Attendance Details (Punch In/Out Time). Timesheet isn’t suitable because it has Project info attached to it wich is irrelevant in my case. Moreover attendance visualization works well in my scenario… employee attendance heatmap

Employee attendance record page for a speciffic date:

(this is how it looks when biometric attendance system was integrated with erpnext)

In my case overall attendance is a factor in salary calculation. And I guess in future it is going t be more and more popular as for instance biometric attendance devices will grow in popularity.

a more flexible Attendance is what everybody needs, so my question … Can your enhancement be merged to the core code some time?

It’s complicated. There should be code review/restructuring as too much of functionality gets duplicated i.e. Timesheet vs Attendance. Otherwise code base would bcome too messy to support and work with in the long run. Also at least changes to Attendance Report would have to be harmonized. It’s a bit too much for me :slight_smile: . I’m still working on upgrading Daily Work Summary to Regular Work Summary :slight_smile:

Also ideally there should be a choice which kind of attendace your organization uses. Full day/half day/present /absent… as is implemented now or a combination of that with Punch In/Out… Consiquently not a trivial bussiness logic.

@vrms I can make a public frappe app that would intergate my changes into errnext. So you just need to install it. Actually I have it already, but I’d need to clean it from unnecessary stuff. Then integration into develop/master branches would be somenone elses job :slight_smile: .

Hi @aleksas

How did you integrate your time and attendance to ERPNext?

This is one feature whose absence is driving me nuts.

that would at least be some sort of start. so, if you ask me … “yes, please do that”

maybe you could take initiative to finding someone capable and willing to help with that

Short answer is: checked tutorials on writting frappe apps and custom doctypes and analyzed erpnext source code…
Long answer: … i’ll publish in github my solution, hopefully in two weeks time (short on time).

P.S. we’ve driven this thread off topic.


sounds good, keep up this contribution mindset

@olamide_shodunke, @vrms HERE you are.
Repo contains app to install into frappe. It alters Attendance DocType to include Attendance Detail and also provides functionality to regulary update Attendance info using external api.


Dear, How To install this Attendance_Extension.
where type the code for installation.
i install erpnext in Virtualbox.
i am not from IT Background. plz guide me for simple steps

i type this command but show error.

cd frappe-bench
bench get-app GitHub - aleksas/erpnext_attendance_extension: ERPNext Attendance DocType Extension
bench install attendance_extension
bench migrate

bench install attendance_extension here you’re missing which website to install the app to, as well as install-app flag. Should look like “bench --site MYSITE install-app attendance_extension”.

Most of it has been integrated in ERPNext :slight_smile: but, I really needed your solution couple of years ago.