Question: How should invoice numbering work in v5?

I’ve got a weird one and I don’t know if it’s a bug or intentional so I thought I’d ask first :wink: I also posted to Slack and said I would post the results of my tests later but understandably it’s fallen off the radar (not a criticism - things move fast in Invoice Ninja World :wink: )

I’ve migrated some test data from v4 where I created 3 recurring invoices and no normal ones. They are correctly numbered R2021-01, R2021-02 and R2021-03.

In v5 I created a normal invoice and it is numbered 2021-01 which is “wrong” from our company finance dept’s standpoint. In v4 it is correctly generated as 2021-04. I then created a recurring invoice which gets numbered R2021-04 which again is “wrong” - in v4 it is correctly created as R2021-05.

Also the invoice number counters don’t make sense to me after migration. The invoice counter is set to 1 and the recurring counter to 5 despite the fact that only 3 recurring invoices were generated in v4. In v4 the sole invoice counter is set at 4 with the example of the next invoice correctly shown as 2021-04.

How do I make this work in v5 so that the invoice numbering is the same regardless of invoice type and the only difference is the recurring prefix? ie just like v4?

1 Like


Thanks for your feedback!

@david, do you have any thoughts?


Firstly, sorry if I miss a topic on slack, there is a lot happening there and I have the memory of a goldfish so i am not ignoring… most likely i’ve simply forgotten to reply… i’ll try and improve my workflow on this… Just give me a @ping and that will get my attention.

In V5, we’ve split the number counters per entity. invoices and quotes can currently share a counter. I don’t see a reason why we cannot also allow recurring invoices to share the same counter.

@hillel is that your thoughts also?

I’m not sure that the issue, it seems like after the migration the counter isn’t set correctly.

@david no apology needed for missing stuff anywhere - you’re all shooting at a lot of targets

It would be good IMHO if the number could be shared between invoices and recurring

@hillel it seems strange to me that given the recurring counter was set to 5 on the migration that the recurring invoice number was “correct” as the next one in sequence after the previous recurring. This, together with the 1st normal invoice starting at 01, suggests that the stored counters aren’t being used in the code. I should have created a separate thread for this issue I suspect as it might be confusing things.

I am also interested in this subject.

I started to raise the question in another post, but here (France, not sure if it’s a Europe-level thing or just us) we have to share a counter between invoices and credits. In fact, we are not allowed to delete an invoice, we must create a credit that “mirrors” the invoice (and uses the same, sequential) counter.

I know there is a lot of work conducted on v5, so @david and @hillel I would really appreciate any possibility of doing this.

Otherwise, I will have to use invoices with a negative amount instead of credits (everyone in France, and I suspect in Europe, would have to do this too).

@david we have a “Shared invoice quote counter” option, maybe we should also add a “Shared invoice credit counter” option?

1 Like


How will we handle the recurring one also?

Invoices generated from a recurring invoice should use the standard invoice counter

1 Like

So I think the confusion is due to the factor that the recurring number in V5 is a new ‘feature’, we certainly use the invoice_number_counter for the recurring invoices that are generated, however the parent recurring invoice is on its own counter.

@david makes sense.

But given my and particularly @stephlegrand’s concerns/needs, will we be able to mimic the behaviour in v4? My accountant will go nuts if our numbering stops being sequential across all invoice types. I suspect there will be even more noise from France/EU users. So on that basis I +1 @hillel’s last comment :wink:

1 Like


in 5.1.26 ( just tagged ) we’ve added another option, Shared Invoice Credit Counter. This can be combined with Invoice / Quote shared counter.

also i’ve updated the migration (for the next release of v4) to export the invoice_number_counter field.

1 Like

@david You, Sir, are a star :slight_smile:

@david this is really awesome, thank you for this :fire:

@brackenhill-mob @stephlegrand

when you get a chance, please test and advise if it isn’t working as expected. from my tests it looks good.

@david One off invoices appear to now work but I can’t fully test this because recurring invoices don’t seem to “fire”, ie get created and emailed, when they are created and started - they just sit in pending even though the cron job is running (according to the laravelle logs). From past testing, these will fire when the date rolls over at midnight tonight. Do you want me to file this as a bug (which I think it is as the recurring invoices screen shows them as started on today’s date so they should fire immediately that they are started IMHO)

Also silly question but are there any switches in settings to turn the linked counters on and off - you mentioned Shared Invoice Credit Counter above but I can’t find it in v5.1.27 (probably being blind!)

The shared counter settings are on Settings > Generated Numbers

@david Recurring invoices are sent - they just get fired on the hour. But I think I’ve found a mega bug with daily ones being fired every hour which I’ll post to github

@hillel That’s where I’m looking. All I see in v5.1.27 is “Shared invoice Quote Counter” which I’ve always seen (just re-installed 5.1.22 to check). I might have misunderstiood but I assumed that with these new switches there would be some way to turn them on and off


one thing to check on the recurring invoices database table, is the next_send_date… let me know if that has the correct date. or whether it hasn’t incremented to the next recurring date.

Hmm… in the latest version there should also be a “Shared invoice credit counter” option, maybe it didn’t make the cut off?