Salary component can't be change in Salary slip?

Happy Diwali to all.

Hi all, I was trying to create a salary slip and wanted to edit some amount there but when I clicked save, all will return back to the original value. Is this normal? If yes that’s means every detail must be accurate when constructing the Salary structure?

Thanks & regards,
Max.

/home/taikin/Pictures/Screenshot from 2021-11-04 17-17-50.png

Go to the Salary Component List and Uncheck depends on payment days from the relevent component. it will not consider formula and you can enter amount manually.

This symptom exists in many cases, even when “depends on payment days” is not selected.

Before I submit a bug report, it should be known if amounts are allowed to be edited in the
pay slip.

I guess I’m two years late but yes, that’s the default behavior of erpnext which makes the salary module completely unusable for small businesses that need flexibility in the salary structure and minimize the no. of clicks the HR person has to go through every month. There’s one line of code in salary_slip.py making this counterintuitive default behavior.

component_row.amount = amount

Remove it and you’ll be fine. Just remember to stash and reapply this change when upgrading.

I’ve found a work around. Along with a few other things I’ve learned, I’m now able to use ERPNext + HRMS to perform payroll in the USA.

@tresila have you tried removing component_row.amount = amount from salary_slip.py? Were there any negative ramifications?

I wonder if we should request a feature to add a setting like Allow inline editing of Salary Slip then the line component_row.amount = amount could have an if statement based on the setting.

I think when Depends on Working Days is enabled, you can’t override the amount because it’s recalculated in the salary slip based on working days.

Another approach would be to create two components, for example one called “My Component” (MC) and another called “My Component (Manual)” (MC_M).

You can then calculate MC via a formula like normal but add a condition that says that it appears only when MC_M is zero. If you need to manually override MC, you set a value to MC_M and MC will stay empty.

This can lead to a more complex salary structure if you need to do it for many components, but it works out of the box and also is a bit more transparent about how it is calculated.

My desired behavior:

  • edit the earnings component value and save normally
  • deductions recalculated on every save based on my modified earnings component (as my country requires employers to pay a percentage tax on behalf of the employees)
  • regenerate the earnings component with default amount on save to prevent accidental deletion of a component

I made 2 key changes to achieve desired behaviour:

  • added if component_type == "deductions" as a condition for component_row.amount = amount
  • in the function of get_amount_based_on_payment_days, change elif not row.amount to elif row.amount is None, this allows me to save $0 values to an edited component

I also made a few other changes like removing the need to submit a Salary Structure Assignment so that I can make changes to them and get them reflected in the Salary Slip on save without the need to cancel and amend constantly. So far, I don’t see any negative impact from these changes, other than the need to stash and reapply the code if I ever need to upgrade. I definitely agree that we should make this a feature. I know Additional Salary is a thing, but if each employee has 5 variable salary components, then the HR needs to make 5 times the no. of employees entries, which defeats the purpose of using an ERP to streamline processes in the first place.