Journal Entry Calculation Error in Salary Processing

Hello,

I am having weird issue.

My Bank Entry completes successfully. However, the GL entries for deductions are wrong. The Base Pay is debited from Salary GL and Credited to the deductions GL rather than the specified deductibles. Please See screenshots of my Salary Structure and the GL Entry for Payroll bank entry:


GL Entry

the thing is, this issue wasn’t there last month as all the entries were processed accurately. I even processed an ad-hoc payroll last week for a new staff and didn’t see this issue. Was there a recent update or did something suddenly change that i don’t know about?

Can someone help with this please?

Thanks!!!

Hi @flexy2ky, i have the same issue (or question).

ERPNext: v8.11.0 (master)
Frappe Framework: v8.10.3 (master)

Regards!

The thing is everything was fine earlier in the month. Below is the journal entry for salary processed on 2nd September:

As you can see all the entries were as they are supposed to be. I hope someone would pick up this issue and advise on what to do as this is salary season and salaries have not been paid due to this error.

1 Like

@flexy2ky someone should really confirm that it is an issue, if so, a github issue should be set up. I have no problem, but as the theoretical part is not handled correctly, i dont now if this is an issue.

Is it that this issue is unique to me? No one seems to be picking up the issue. I have set up several demo instances to test and the error shows up on all of them. Someone should please help resolve this issue. This will be appreciated.

Hi @flexy2ky, the issue must be loaded in github. Could you do it with the best possible description and the captures you mention above?

Im facing the same issue. Any solution to this issue?

@josmediaz21 so far no one has responded to this issue and it is disappointing considering the possibility that everyone who uses the bank entry option on payroll processing could be facing the same issue. I also raised it on github but no one has picked it up there either.
https://github.com/frappe/erpnext/issues/11030

1 Like

Hi @flexy2ky
Confirm that it is a bug. I’m working on it.

2 Likes

I saw that you fixed already, I am noob about it. I need to fix it in my server. Is there any way to fix this kind of things without update the version completly.?
I mean, without “bench update”.

There are three ways I can think of:

  1. You can cherry-pick the commit that fixed the problem to your repo.
  2. Create a patch from the commit that fixed the problem and apply to your repo.
  3. The fix is actually a one-word fix. You can simply copy the change in the commit to your own repo.

Pick whichever is easiest (probably option 3) for you.

1 Like

@tundebabzy i must appreciate you for picking up this issue and helping to resolve it. It has given me grief since it propped up on my instance. However, i ran bench update to get the new script and ran into some problems. It would have been easy for me to run the fix directly if i had seen it earlier. The error i am now having when i run bench update is:

root@ip-172-31-21-199:/home/frappe/frappe-bench# bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream master
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream master
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
    Updating node libraries…
    INFO:bench.utils:npm install
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
    npm WARN frappe@ No description
    Backing up sites…
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 289, in backup
    odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, backup_path_private_files=backup_path_private_files, force=True)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 166, in scheduled_backup
    odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, force=force)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 170, in new_backup
    delete_temp_backups(older_than = frappe.conf.keep_backups_for_hours or 24)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 189, in delete_temp_backups
    os.remove(this_file_path)
    OSError: [Errno 21] Is a directory: ‘./site1.local/private/backups/site1.local’
    root@ip-172-31-21-199:/home/frappe/frappe-bench# cd sites
    root@ip-172-31-21-199:/home/frappe/frappe-bench/sites# bench drop-site site1.local
    You should not run this command as root
    root@ip-172-31-21-199:/home/frappe/frappe-bench/sites# cd …
    root@ip-172-31-21-199:/home/frappe/frappe-bench# bench drop-site site1.local
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 337, in drop_site
    _drop_site(site, root_login, root_password, archived_sites_path, force)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 350, in _drop_site
    scheduled_backup(ignore_files=False, force=True)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 166, in scheduled_backup
    odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, force=force)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 170, in new_backup
    delete_temp_backups(older_than = frappe.conf.keep_backups_for_hours or 24)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 189, in delete_temp_backups
    os.remove(this_file_path)
    OSError: [Errno 21] Is a directory: ‘./site1.local/private/backups/site1.local’

i can’t seem to figure out why site1.local is giving me that error. i had changed my default site to erp.myurl.com and my site was running fine. after this failure though, my site gets stuck verifying login. Can you advise me on how to correct this so i can get my site up? Would appreciate your help.

Do you have a folder named site1.local inside your backup directory? Your backup directory is frappe-bench/sites/site1.local/private/backups.

Meanwhile, you shouldn’t be logged into your terminal as root. E fit wound persin ooo.

1 Like

@tundebabzy lol!!! bros na true you talk. now that last part i understand very well. I’ve tended to log in as root as most times due to ubuntu low-level user permissions some commands refuse to work even when i increase permission level by using sudo. but i’ll take your advise and never log in as root again. I had dropped site1.local after creating a new site called erp.myurl.com and a backup of the dropped site was created in the directory or mentioned. I manually deleted the backup directory and my upgrade was successful, although my terminal connection terminated after several hours but i’ve checked my instance version and it’s 9.1.0 and everything seems to be running fine. Thanks boss for coming to my aid.

one last note though and i don’t know how you can help or where you can point me to. I’m trying to use condition and formula to calculate PAYE (you know our tax is a bit complex with several conditions). can you point me in the right direction on how to accomplish this? i know the current direct entry works but knowing how to use the formula and condition to calculate the tax will make the whole process standard. I know i have jumped to another issue on this thread but you no say we sabi do oliver twist. I’m a noob and a complete novice on coding. But ERPNext is so simple to use and i’m tempted to use it to the fullest possible functionality. I will appreciate your help in this regard. Thanks bros!!

Because of the conditionals in the PAYE tax table, I don’t think ERPNext will be able to work it out except you break the PAYE into multiple components. I’ll investigate that when I have time though

1 Like

@flexy2ky Just give me little time because i am very business now i will show you how to use erpnext to calculate PAYE

1 Like

@tundebabzy @Fred1 Thanks for your interest in this. I will await your feedback on this.

Much appreciated.