DocType subdocument

Hi everyone,

I have a doctype like this
image

I need to be able to open it separately to fill in the items on one hand.
On the other hand i’d like to use it as a child table for other doctype. All the existing items should be visible and the corresponding check-boxes should be editable from the parent doctype.

Any idea would be appreciated.

Regards!

You can use one child document for multiple parent document. But can’t use the same document as a child as well as a parent.

Make two separate doctypes, one for child one for the parent (just make a duplicate of it).

I did exactly what you suggest but the problem is that inside parent doc i can’t see the existing records in child, instead i can add new records but this is not what i need. The child table should be populated in a separate form and all these records should be visible in the form of parent doc and editable.

you have to fetch it via script.

It seems i’m not able to make it work. Let’s revise:

Main doctype:

and the data:

Second document:

I can’t think of a script able to fetch data from main doc into second doc’s table (onload).

you can refer ERPNext code for the same.

e.g. Check how they make Delivery Note/Production Order from Sales order (by fetching details from Sales order)

Refer code in following files -
Sales_Order.js

Sales_order.py