How to make "create" functionality? (like in Sales Order)

In ERPNext there is a functionality where there is a button in the Sales Order that creates a Sales Invoice and make it inherit/copy values from it.

I want to make the same functionality for 2 other doctypes.
Note: the two doctypes are not submittable.

You can create a custom button in js (or use the custom script option in-app to add the button) and define the next option.

Here are some references:

  1. Custom button in js

  2. Reference to the Sales Order to invoice code:

This should get you started.

1 Like

Thank you. it helped a lot

But to create this functionality and copy the values from it, you also have to create a custom function in the .py file, right?