Filter link field encluding used docs

Hello!
I have created a new DocType and inside it I created a link field of Sales Order

Its is working fine

But I need to filter this field to get only Sales Orders that were not used in other docs of the same DocType. How could I do that?

Thanks in advance.

With a Custom Script you can set your own conditions. Also, you could tick the “unique” checkbox in the field “Pedido de Venda”.