How do I make a property of Item available in Sales Order Item before the Sales Order is saved?

I have added a custom field to Item as a virtual field and implemented it in the Item class using the @property decorator. When I select this Item in the items table of a Sales Order, I need to access this value to conditionally display some fields. Since item_code in Sales Order Item is a Link to Item, I tried doc.item_code.custom_field, but this is not returning the expected value.

Is there a way to make this value available in JS before saving the Sales Order?

Item in a sales order is a child table. To access values you’ll need something like:

doc.item.custom_field (if you are iterating rows)

Some sample code:

   for item in doc.items:
        if  # Simplified attribute check
            custom_field = my_field