mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Refactor and improve invoices
- `runner 'Invoice.cancel_overdue_invoices'` in `schedule.rb` is changed to `rake 'invoices:cancel_overdue'`. - `invoices.payment_term` database column is removed and its value is hardcoded in UI. - `invoices.paid_at` is removed as unused - `invoices.due_date` column's type is now `date`. - `Invoice#invoice_items` renamed to `Invoice#items` and `Invoice` interface to get a list of items is unified. - Default date format in UI. - Default translations are used. - Tests improved. - Specs converted to tests and removed along with factories. - Database structure improved.
This commit is contained in:
parent
d86ec026e3
commit
a97728c0f3
65 changed files with 758 additions and 341 deletions
|
@ -0,0 +1,5 @@
|
|||
class RenameInvoiceItemsAmountToQuantity < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :invoice_items, :amount, :quantity
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddInvoiceItemsInvoiceIdFk < ActiveRecord::Migration
|
||||
def change
|
||||
add_foreign_key :invoice_items, :invoices, name: 'invoice_items_invoice_id_fk'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeInvoiceItemsInvoiceIdToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :invoice_items, :invoice_id, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeInvoiceItemsQuantityToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :invoice_items, :quantity, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeInvoiceItemsUnitToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :invoice_items, :unit, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeInvoiceItemsPriceToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :invoice_items, :price, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeInvoicesDueDateToDate < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :invoices, :due_date, :date, null: false
|
||||
end
|
||||
end
|
5
db/migrate/20181022100114_add_invoices_issue_date.rb
Normal file
5
db/migrate/20181022100114_add_invoices_issue_date.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddInvoicesIssueDate < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :invoices, :issue_date, :date
|
||||
end
|
||||
end
|
5
db/migrate/20190311111718_remove_invoices_paid_at.rb
Normal file
5
db/migrate/20190311111718_remove_invoices_paid_at.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class RemoveInvoicesPaidAt < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :invoices, :paid_at
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveInvoicesPaymentTerm < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :invoices, :payment_term
|
||||
end
|
||||
end
|
|
@ -1039,11 +1039,11 @@ ALTER SEQUENCE public.epp_sessions_id_seq OWNED BY public.epp_sessions.id;
|
|||
|
||||
CREATE TABLE public.invoice_items (
|
||||
id integer NOT NULL,
|
||||
invoice_id integer,
|
||||
invoice_id integer NOT NULL,
|
||||
description character varying NOT NULL,
|
||||
unit character varying,
|
||||
amount integer,
|
||||
price numeric(10,2),
|
||||
unit character varying NOT NULL,
|
||||
quantity integer NOT NULL,
|
||||
price numeric(10,2) NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
creator_str character varying,
|
||||
|
@ -1078,13 +1078,11 @@ CREATE TABLE public.invoices (
|
|||
id integer NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
due_date timestamp without time zone NOT NULL,
|
||||
payment_term character varying,
|
||||
due_date date NOT NULL,
|
||||
currency character varying NOT NULL,
|
||||
description character varying,
|
||||
reference_no character varying NOT NULL,
|
||||
vat_rate numeric(4,3),
|
||||
paid_at timestamp without time zone,
|
||||
seller_id integer,
|
||||
seller_name character varying NOT NULL,
|
||||
seller_reg_no character varying,
|
||||
|
@ -1118,7 +1116,8 @@ CREATE TABLE public.invoices (
|
|||
cancelled_at timestamp without time zone,
|
||||
total numeric(10,2) NOT NULL,
|
||||
in_directo boolean DEFAULT false,
|
||||
buyer_vat_no character varying
|
||||
buyer_vat_no character varying,
|
||||
issue_date date
|
||||
);
|
||||
|
||||
|
||||
|
@ -4234,6 +4233,14 @@ ALTER TABLE ONLY public.account_activities
|
|||
ADD CONSTRAINT fk_rails_d2cc3c2fa9 FOREIGN KEY (price_id) REFERENCES public.prices(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: invoice_items_invoice_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.invoice_items
|
||||
ADD CONSTRAINT invoice_items_invoice_id_fk FOREIGN KEY (invoice_id) REFERENCES public.invoices(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: messages_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -4926,6 +4933,22 @@ INSERT INTO schema_migrations (version) VALUES ('20181001090536');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181002090319');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181017092829');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181017153658');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181017153812');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181017153935');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181017154038');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181017154143');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181017205123');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181022100114');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181108154921');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20181129150515');
|
||||
|
@ -4962,3 +4985,7 @@ INSERT INTO schema_migrations (version) VALUES ('20190102115333');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190102144032');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190311111718');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20190312211614');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue