Date for invoice sequences

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.

Opinions?

Supplier invoice numbering is not very important but why not to have a kind of ordering with the number.

Sorry, I didn’t understand this sentence.

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.

I mean it is not important but why not.

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.

No, it has nothing to do with posting numbers. There’s the “Libro registro de facturas recibidas” (Log book of received invoices).

@albert is right about Spanish requirements in received invoices.

After reading the Article 64 of the real decreto that talks about libro registro de facturas recibidas, specially the point 4 I understand that the numbers shoulb be correlative based on their reception date. The statement clearly says: “Se consignarán su número de recepción”.

@albert could you explain some example when the invoice will have an invalid number when using the year substitution?

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.

And this is respected currently. The schema is not random and is well defined.

I created Issue 7716: Use accounting date to format supplier invoice number - Tryton issue tracker

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.

It is true that the sequence used come from the accounting_date.