TEMPORARY FIX FOUND!!!
I suggest you check each salary structure, and wrap any formulas entered in the salary component formula field, particularly those that have more than one or two operations, in the following Python function:
float(“{0:.2f}”.format(YOUR_FORMULA_HERE))
This will round everything to two decimal points, and will keep all your calculations from causing these errors before a fix is made.
All text below is the trial and error I followed to stumble upon the fix above. Read, only if you desire.
I´m getting the same, I have checked each salary structure formula to verify they all make equal amount, but the problem persists:
“Total Debit must be equal to Total Credit. The difference is -0.0010000000002”
I did have one test instance where ONE unique individual’s salary slip was not submitted, and it did create the Payment Entry for all others perfectly. I am using a Fortnightly payment structure.
I fixed the salary structure, but the problem persists:
Troubleshooting: In my case ERPNext says that “multiple active salary structures exist for that employee”, when pressing the “Create Salary Slip” button in the Process Payroll tool. I have verified, and I found ONE more salary structure for the time period which was active. I inactivated it, and no longer get the message when pressing “Create Salary Slips”. This was the employee who gives me “trouble” when making the payment entry.
One other factor that might be affecting is that this employee has a particular deduction which others do not have, and that might be generating the extra numbers. I tried removing that particular calculation, leaving all employees with the same calculation, and still got the same error. (NOTE: I took the deduction away and still get the error)
Question: Is there a formula that can be used to “round” the numbers within the formula square when calculating payroll? Should it be Python or Javascript notation? SELF-ANSWERED: It’s in Python.
One other thing I checked, is the specific accounts for each salary component. Since it was stated in another post, the component DocType does not automatically show Liability accounts, but will successfully link to them if entered manually.
Changing the account name AFTER linking and saving manually, does not affect the error.
However i have been able to isolate it to ONE employee’s salary structure. Even though the salary slip is in balance, something is up with this particular structure. I’m going back to check the formulas.
No luck. I tried everything and there seems to be a certain rounding issue.
Now trying a rounding formula using python (Formats and then converts back to float from string data type):
float(“{0:.2f}”.format(YOUR_FORMULA_HERE))
ERPNext: v7.2.27
Frappe Framework: v7.2.27