Accounting Entry not generated for Purchase Receipt having rejected quantity

In Purchase Receipt of item with rejected quantity, the system is not generating corresponding accounting entry. However the stock ledger entry is being generated correctly.

without rejected qty, system correctly generates accounting entry.

is there any workaround for this challenge?

there is GITHUB issue as well for this same challenge by one one user.

https://github.com/frappe/erpnext/issues/14981

Help required to fix this bug!!!

the issue has been updated with root cause analysis.