Issue while loading the data from another doctype

I have auto load the product from product doctype instead of their ID’s I get the product model number. But currently I encounter another issue in it.
When clicked on the product loaded to enter their values like achievement type or achievement value it removes the product number and we have to reselect it.
when we auto load the product instead of their ID’s we get the product model number. But currently we encounter another issue in it.
When clicked on the product loaded to enter their values like achievement type or achievement value it removes the product number and we have to reselect it.

It would be great if someone can help us with these issue.

Can you please share the screenshot and code?

Yes sure.