Weirdest thing. I get this error when I hit "New" Sales Invoice. But I don't get the error when I open an existing Sales Invoice (unposted). This seems to be a contradiction because both open the same page right?
I believe error stems from my code here (page extension on Sales Invoice page):