For the same reasons as with expenses[0], users are no longer expected to manually set invoice status, and is now linked to their collections. In this case, however, we had to remove the ‘sent’ and ‘unpaid’ status options, because these _should_ only be set manually, as there is no way for the application to know when to set them. Thus, there could be inconsistencies, like invoices set to ‘unpaid’ when they actually have collections, or invoices that were ‘sent’, then transitioned to ‘partial’/‘paid’ due to a collection, but then reset to ‘created’ if the collection was deleted. [0]: ac0143b2b0b772e155ef8525e147786700403578
29 lines
797 B
PL/PgSQL
29 lines
797 B
PL/PgSQL
-- Deploy numerus:available_invoice_status to pg
|
|
-- requires: schema_numerus
|
|
-- requires: invoice_status
|
|
-- requires: invoice_status_i18n
|
|
|
|
begin;
|
|
|
|
set search_path to numerus;
|
|
|
|
update invoice set invoice_status = 'created' where invoice_status = 'partial';
|
|
delete from invoice_status_i18n where invoice_status = 'partial';
|
|
delete from invoice_status where invoice_status = 'partial';
|
|
|
|
insert into invoice_status (invoice_status, name)
|
|
values ('sent', 'Sent')
|
|
, ('unpaid', 'Unpaid')
|
|
on conflict (invoice_status) do nothing
|
|
;
|
|
|
|
insert into invoice_status_i18n (invoice_status, lang_tag, name)
|
|
values ('sent', 'ca', 'Enviada')
|
|
, ('unpaid', 'ca', 'No cobrada')
|
|
, ('sent', 'es', 'Enviada')
|
|
, ('unpaid', 'es', 'No cobrada')
|
|
on conflict (invoice_status, lang_tag) do nothing
|
|
;
|
|
|
|
commit;
|