You need to write custom script. And you can decide if this custom script to be executed by button or when new DN or SO is created or when they are saved.
Just for info on my case this customer is doing his monthly SI per customer and for each they have more than 80 DN… Now imagine how big the SI will be if no group by our sum per item available.
Also in the future the customers PO should be text (more than 140 chars) to keep all DNs produced.