How can I block save when there's isn't any record in child table?

Hi,

I have 2 DocTypes, Master and Details… I must have at least one record in my Details, before save.

What’s the best way to do these?

Another question: How can I create in browser N records in Child Table when click in a button?

Thanks,

Cheers!

For the first question
Open doctype master and check mandatory for child doctype table.

Thanks BhupeshGupta!

About the other question, what’s the better aprouch to do that?

Check “Get Outstanding Vouchers” functionality of Payment Tool form, it fetches all outstanding vouchers on click of the button.

https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/doctype/payment_tool/payment_tool.js#L84