Generic plv8 function to generate a documents workflow from its source doc

Generic plv8 function to generate a documents workflow from its source document

For example create Sales Order WF from Sales Type WF / create Quality Test WF from
Quality Plan WF