I tried the first bit of code provided and this allows me to create a invoice after the code has been amended however the dynamic field is not working I then tried the seconds bit of code and I am unable to create a new invoice using this 2nd option.
At present I am using the first option of code you have provided however I have noticed an error in the php logs
“[04-Dec-2018 12:36:37 UTC] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AOS_InvoicesViewEdit has a deprecated constructor in C:\inetpub\wwwroot\CRM\custom\modules\AOS_Invoices\views\view.edit.php on line 4”