Howto link Sales Invoice with customer doctype?

Is it possible to generate sales invoice with custom doctype?

Like I created a doctype to rent something and when customer returns it a sales invoice to be generated.

Thanks

Yes, you can generate Sales Invoice from your custom doctype. You simply have to create a Sales Invoice doctype using your code and insert it from your custom doc’s on_submit hook.