How to automatically create rows in Child Table based on another Doctype

I can’t think of anything that uses logic similar to what you’re trying to do. Summary doctypes like this are generally a bad idea, since they violate the principle of single-source truth.

If you’re looking for examples of adding to child tables programmatically, a quick search on this forum turns up lots of examples. For example: