AutoFilled Item Code in Create Batch Modal is incorrect or blank


We are using Frappe 12.13.0 and ERPNext 12.16.2

If we create a Purchase Receipt, all works fine for the first time. Then i navigate to purchase receipt list page and again click the New button to create second purchase receipt.

In that second purchase receipt, , when we add a new line Item, and click on Create Batch in the Batch Field, it is either showing previously created purchase receipt Item code in the Create Batch Modal or some times The Item code is blank.

If we refresh the Page and again click on the Create Batch, it is working properly.

Ideally, it should populate the Item code in the Line Item. We guess this is some kind of caching issue.

Any inputs/suggestion on how to solve this.