Invoice numbers look cosmetic until two requests race and you get 1043 twice, or nothing at all between 1042 and 1044. Gaps and duplicates are both audit problems.
So the counter belongs in the store, scoped per series and per period. VAT rules shape the lines, and the sequence is what makes the document legal.
Worth checking where yours increments. https://shipmindlabs.com/c/10a95223