Sales Invoice: How to get data from the process generating it?

Fellow coders! Is there a way of knowing what process generates a Sales Invoice and how to get data from it?

Use case: A custom field in a subscription mixed with data from it’s subscription plans delivers information needed on invoices.

With a client script for Sales Invoices, that data of previous doctypes isn’t accessible. A server script bound to subscriptions on the other hand has all the necessary information via sql but can’t access the resulting invoice. (Or is it / can it?)

The scheduler should have access to both things but so far I haven’t found the place where subscriptions generate invoices. The following two files seemed promising but don’t seem to be it (or are they?)

apps/erpnext/erpnext/accounts/doctype/subscription
apps/erpnext/erpnext/accounts/doctype/process_subscription/process_subscription.py

Or am I barking up the wrong tree here?