It turn out that we have to make a ‘bridge’ doctype to connect the doctypes (I don’t know if this is the standard case of Frappe or not, but I see it in ERPNext). This bridge doctype will be the child table of the main doctype and having a field of type Link pointing to the target doctype.
The issue:
- if directly using the target doctype as child table than we lost the independency of the doctype.
- as child doctype, we can’t directly open form for that doctype to add/edit.
Solution:
- By using bridge doctype, the field act as link to the target doctype so we can add/edit/open the form independently.
- This bridge doctype may or may not have the same fields as the target doctype. It can even have only 1 field and with type of Link.
Continuing this arrangement is how to pass a value from parent to target doctype. But this is in other topic (How to pass parent field value to other doctype when add from child?)