Prevent using same sequence on earlier customer invoice: which date to use?

Disculpen por no responder en ingles.
En España se dispone de un plazo de hasta el día 16 del mes siguiente para emitir una factura desde el devengo del impuesto, esto quiere decir que si vendemos un producto a un cliente el 30 de diciembre se podría emitir factura el día 15 de enero pero con fecha de contabilización 30 de diciembre. Si el día 31 de diciembre hacemos otra venta y queremos emitir factura ese mismo día no podríamos hacerla hasta que se hubiera emitido la anterior del día 30 si se sigue la numeración por fecha de contabilización.
Por esto la numeración de la factura se realiza conforme a la fecha de expedición

1 Like

Sorry but for me your example has contradictions. You can not travel in time from the 15 January to issue an new invoice on the 31 December.
The date of issue is always today. So for me my previous comment is still valid and reinforced by your comment.

In the mentioned example does not talk about the accounting date.
It only talks about the invoicing date and does not explain anything that the invoice date should be when the goods are sent.

So in such case, you just set the invoice date on 16th of the next month despite the goods have been set on the past month.

Normally customer invoice date should always be today. You can not compute the term from the past, it is unfair for the customer and if you want to invoice in the future, you should wait for it.

Yes, I mean in such case the invoice should not be created until 16th of the next month. Sorry for the missundestanding.

IIUC the @roliver example says:
today 15th January issue and invoice with invoice_date today (15th January) and accounting_date 30th December.
This is allowed in Spanish account because goods were shipped on 30th December, so taxes can be posted on this date.

Indeed accounting date would be 30th December.

But invoice taxes need to be on December as mentioned above.

So the current behavior is the right one but of course you need to use a sequence per fiscal year.

mmm … I don’t think so.
Let’s simplify the example with a same fiscal year, the invoice of the example now is invoice_date 15th December and accounting_date 30th November.
As currently is preventing after invoices based on accounting_date user cannot post this invoice because he has posted other invoices from 30th November to 14th of December which has been shipped along this period and could be invoiced faster.

I think business with such difficulties must use a sequence per period.
There is no way that the constraint could be using the invoice date because the numbering is based on the accounting date. The invoice date is only used for payment term.

I’m afraid users will not agree with that configuration.
We used to install account_invoice_consecutive and we were happy to get it in core. Nevertheless we will have to extend the method managing InvoiceNumberError.

I do not see the point but more over for me it is wrong. So please provide rational about the need.

The rational:
Spanish account requires correlation between numbering and “fecha expedición” (this is invoice_date) for customer invoices.
With the current implementation this is right when accounting_date is empty or equal to invoice_date. This is the most of the cases.

The needs:
Some companies want/need to declare and post taxes of invoices in the period in which goods were sent as the law allows a range of 15 days to do that.
So as an example they legally could post today:

  • Invoice X with invoice_date today and without accounting_date
  • a few minutes later Invoice X+1 with invoice_date today and accounting_date 30th November.

Sorry if it’s not clear but I can’t explain it better …

I have a huge doubt about this statement. For me it is a wrong interpretation because this can not guarantee a continuous numbering for all invoices over a single fiscal year (or tax period).
I can not find your statement in the invoice manual which seems to be just a re-transcription of the EU Directive 2001/115/EC.
For me it is clear that the series must be continuous inside a single fiscal year (or inside a single tax period if the period is clearly identified in the numbering).

As usual the Spanish accounting documentation is quite ambiguous and not very explicit.
But in that document they talk in many places about required invoice data:

  • correlated numbering and sequence.
  • issue date (“fecha de expedición”)
  • transaction date (“fecha de operación”) if differs from issue date. It is the delivery date of goods/services.
  • other data …

AFAIU this issue date is invoice_date in Tryton.
If we check de foundation sii module or thirdparty sii module we can find it as FechaExpedicionFacturaEmisor. The accounting date should be FechaRegContable and the transaction date should be FechaOperacion.

So summarizing:

  • the method get_next_number() should use invoice_date to get the sequence for customer invoices.
  • the method set_number() should use invoice_date for customer invoices to check later invoices.

I do not understand how you came to this conclusion.
I think I clearly showed that such change will make the invoice numbering inconsistent inside a single fiscal year (or period).
So for me you are wrongly interpreting the requirements.

How will you manage the SII declaration in this scenario?

The consistency is against issue date …
Anyway we have just queried to “agencia tributaria” about it.

PeriodoLiquidacion: { Ejercicio: 2021, Periodo: 12}
FechaExpedicionFacturaEmisor: 15/01/2022
FechaRegContable: 30/12/2021
FechaOperacion: 30/12/2021

[quote=“sergyo, post:19, topic:4840”]

As far as the invoice is sent for days before issuing it (19/01/2022) I won’t see any issue by sending the invoice in a past period.

hola:

disculpa una pregunta.

¿te refieres a la fecha de devengo para el iva? La cual se produce cuando se realiza la operación o bien la adquisición de la mercancía que no tiene porque coincidir cuando se factura.

hello:
excuse a question.
Do you mean the accrual date for the VAT? Which occurs when the operation is carried out or the acquisition of the merchandise that does not have to coincide when it is invoiced.

Si, la fecha de registro contable debe ser la fecha del devengo del impuesto y esta no tiene porque coincidir con la fecha de emisión de factura que puede ser igual o posterior