To start, you can turn off the Custom transaction numbers feature from the Account and Settings to prevent accidental changes to your sales forms numbering. This way, QuickBooks automatically assign a transaction number for you. Disabling the feature will hide the Invoice no. field from your forms, yet, you can still print them for your customers.
Go to the Gear icon, then select Account and Settings under Your Company.
Tap on Sales at the left pane, then disable the Custom transaction numbers.
Select Save, then Done.
Once done, the system will assign the numbers for you.
I've added these screenshots for your visual references.