The series name seems to works, but wheni delete a sales invoice the series not consider the cancellation and the counter is not descreased. If I continue to create and delete sales invoces the counter at every iteration is always counter+1.
This problem happen only if I insert in the series a variable tag like YY, infact if i use the standard series I-, the counter increase or decrease correctly inserting or deleting invoices,
I update the counter directly on table tabSeries to avoid the problem, in this case, but I can’t do update on table every time I have to cancel a draft invoice.
Is there a possibilty to do automatically by the system?
Isn’t that already possible through Naming Series DocType ?
There’s a section in the DocType labelled ‘Update Series’ in which you can select the series whose counter you want to change. You can use that even for custom naming series.
As for the issue you’re referring to, it seems to be working just fine for me for custom naming series.
I hope you’re deleting it properly in a reverse sequence - If you have 3 invoices and you delete 3rd first then the counter gets decrease by 1, but if you either delete 1st or 2nd invoice first then in that case the counter wont reset.
and I have two sales invoice in the table tabSales Invoice
name … naming_series
I18-00001 … I.YY.-
I18-00002 … I.YY.-
If I delete the I18-00002 the counter si not decreased.
The problem is in the naming series saved in the table tabSales Invoice.
If i use I- instead, that is the default Sales Invoice series it works correctly. Modifing manually the field naming_series in the table *tabSales Invoice as I18- it works too, so the problem is in the difference between the name inserted from ERPNEXT in the tabSeries table (I18-) and the value inserted in the tabSales Invoice.
The only way to have a correct behaviour now is to avoid to use the dinamic part .YY. in the naming series, but this si critical for me because I have to reset the counter every year, and if I user only I- this will be not possible because I will have duplicate primary key for the table tabSales Invoice.