Refresh_field("items") doesn't fetch data for table items


I wrote a simple script for a barcode scanner but cannot make erpnext to fetch data for linked objects (i.e. items in stock entry)

A simple code:

let d = frm.add_child("items");
d.item_code = doc.item_code;

as far as I understand should fetch associated values (i.e. d.uom, d.item_group), etc.?

If I’m wrong, how should I do it correctly, to avoid manualy assingning values?

Best regards,