With the following SQL code when issuing or editing 1 document, a copy of it is automatically created in a desired document. Also, optionally, it is possible to change the document based on the customer / supplier code.

This code must be affixed to the corresponding document, in place:

Settings-> Purchases / Sales-> Documents-> Execute SQL

For sale by automatic copying to a document with line number 104: