Commit Graph

3 Commits

Author SHA1 Message Date
jordi fita mas 775cdef097 Add foreign key constraint to invoice_number_counter.company_id 2023-06-07 13:11:29 +02:00
jordi fita mas 083d14e324 Allow to change the current year’s invoice number counter
This is for new users that do not start using the application from the
beginning of the current fiscal year and, therefore, need to create
invoices starting from a specific number.

I had to change the constraint on the currval to allow zero, otherwise
it would not be possible to set 1 as the next number, because users
can also not delete the row.
2023-05-31 20:01:00 +02:00
jordi fita mas 880c4f53b2 Add the function to get the next invoice number
I can not use a PostgreSQL sequence because invoices need to be gapless,
and sequences are designed to not rollback, for performance reasons.  In
this case, the performance is secondary because the law does not care.
2023-02-17 14:48:24 +01:00