Autofill Purchase Invoice & Purchase Order number in new doctype

Hi, i have a custom label/item called “Period” in my purchase receipt doc, which will create a new “Period” doctype when its clicked.

Then in the Period doctype there are 3 fields, Purchase Receipt, Purchase Order and Purchase Invoice.

I can only add the Purchase Receipt number automatically, what about the Purchase Order and Purchase Invoice number so that it is filled automatically too? Thank you

PO and PI will only be filled if you have these two fields filled in PR, fetch these two fields in your PR and it will reflect in your Period DocType.

Also, what if you have multiple Invoices against a single PR, how are you handling that case here?