Populate List of Packing Slips inside a Delivery Note

I’m new here. For my use case, I’ll need Packing Slip details in the Delivery Note. I created a manual implementation: a custom DocType child table for Packing Slip, and added this Table to the Delivery Note Form. I can now manually add Packing Slips to my Delivery Note.

How can I automatically populate that list with the Packing Slips that are linked to this Delivery Note? My goal is for the table to be read only, automatically populated.

The operational need is to create a single document that has the Delivery Note info at the top, and each linked Packing Slip listed on the same page.

I suppose a script is needed to select from all Packing Slips only those that are linked to the current Delivery Note, and then copy into the table. I’m new to ERPNext, not sure how to write the script (JS, Python?), and where to save the script.

Thank you.

Ok, it a naive question. Best to not burden the database. For my custom Delivery Note print, I’ll add some Jinga like this to the html:

{%
    set slips = frappe.get_list(
        'Packing Slip',
        filters={'delivery_note': doc.name}
    )
%}
{{ slips }}

And, if I need validation that Packing Slips cover all the Delivery Note items, I will add a validation script to the Delivery Note form. I have removed the custom Packing Slips table from the Delivery Note.

For anyone listening, thanks for your patience while I research ERPNext/Frappe and think this through.