Payment Reconciliation for Credit Notes

Hello,
I am facing an issue when trying to Reconcile Credit Notes for a Company other than the Default Company. I have a multi-company setup.

Steps to Reproduce

  1. Create a Credit Note from Sales Invoice for Company 2 (Default = Company1)
  2. Reconcile the Credit Note from “Match Payment with Invoices”
    a. Select Company 2, Customer, Customer Name
    b. Fetch Unreconciled Entries
    c. Reconcile Credit Note with an Invoice
  3. This works well for Company 1 since it is the default company
  4. For Company 2, on click of Reconcile button and Error is thrown “Journal Entry ACC-JV-2020-01186: Account Debtors - D does not belong to Company 2”

I checked the code and found that the company parameter is not passed which is causing the JV to be created for Deafult company and due to which this error is thrown

Can someone please validate the issue? Or am I missing something?

Github Issue
https://github.com/frappe/erpnext/issues/22834