Batch selection not filtering based on Item in Purchase Invoice with Update stock checked

In “Purchase Invoice” with checked “Update Stock”,
Batches showing for all items instead of specific selected item.

Once above done, need to remove this(as not require anymore)
“BATCHID is not a valid Batch Number for Item ITEMNAME”

Here is isssue on github
Batch selection not filtering based on Item in Purchase Invoice with Update stock checked

@mdwala
Thanks for creating a github issue for this. Request you to please follow up on the github issue for the same.

Issue was created and solved by PR.
Link:
https://github.com/frappe/erpnext/issues/8963