This is one of those things that drives me mad, that I can never find in the documentation. I’m currently running Gnucash 2.4.11 on Mint 14 (based on Ubuntu) and sometimes need to edit the invoice template. I can never find where the damn thing is.
Currently, it’s here (along with other templates):
/usr/share/gnucash/guile-modules/gnucash/report/invoice.scm