Currently the date used as substitution as invoice sequences is the one of the invoice or Today (if no invoice date is given).
So if the user uses the “${year}” substitution, it will be the one of the invoice, etc.
I don’t know how others or other countries handle this but I would expect the date to be the one of the invoice for “out” invoices and be the accounting date for “in” invoices. In fact, we could probably also live with using the “accounting_date” in all cases.
In Spain numbering for this kind of invoices is important and must be shown in one official report.
I care about it because the new wizard for creating fiscal years duplicates sequences. Right now we cannot use the “year” substitution for supplier invoices because we need to use the accounting date.
So if others don’t care much about it, we could change invoice’s set_number() to use the accounting date.
Are you sure to not mix with the posting number of the move?
Tryton generates a number due to detail implementation, it was never a goal for supplier invoices.
Say you use the {year}/ prefix. And 765 is the next number in the sequence.
You receive on 20/01/2019 an invoice from supplier dated 31/12/2018, and you decide to put 20/01/2019 as accounting date. You would get invoice number 2018/765. But you really want it to be 2019/25 (or whatever the next number is).
I do not think it is what will happen. The sequence used is the one from the period which is selected by using the accounting date first or the invoice date. So the number will be 2018/25.
So for me, there is no big deal because the sequence is still increasing but it will be less astonishing that the formatting of the number use the date used to select the period.
But user will still be able to break the numbering without Remove check_invoice_sequences (#5205) · Issues · Tryton / Tryton · GitLab
Yes sorry, you’re right. The number will be 2018/25.
In Spain it is a “big deal” because you may use different numbering schemes but they must “justified”: It must be a clear criteria that does not change randomly and numbers still must be consecutive in the same numbering scheme.
But I think we all agree that using the accounting date is the right thing to do.
For me the accounting_date should be used for out invoices too. As the accounting date defines to which fiscalyear the invoice belongs. Currently you will have invoices with 2019 in its number when using ${year} when the accounting_date is from 2018 and the invoice_date is from 2019.