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:
Artur Beljajev 2018-10-17 12:21:04 +03:00
parent d86ec026e3
commit a97728c0f3
65 changed files with 758 additions and 341 deletions

View file

@ -1,7 +1,5 @@
DEFAULTS: &DEFAULTS
account_id: 1
one:
<<: *DEFAULTS
invoice: paid
account: cash
invoice: one
bank_transaction: one
created_at: <%= Time.zone.parse('2010-07-05 10:00') %>

View file

@ -4,6 +4,12 @@ cash:
currency: EUR
registrar: bestnames
two:
account_type: cash
balance: 100
currency: EUR
registrar: goodnames
not_in_use_cash:
account_type: cash
balance: 0

View file

@ -1,13 +1,6 @@
one:
description: Acme services
price: 5
amount: 1
quantity: 1
unit: pc
invoice: valid
two:
description: Acme services
price: 5
amount: 2
unit: pc
invoice: valid
invoice: one

View file

@ -1,5 +1,5 @@
DEFAULTS: &DEFAULTS
created_at: <%= Date.parse '2010-07-05' %>
one:
issue_date: <%= Date.parse '2010-07-05' %>
due_date: <%= Date.parse '2010-07-06' %>
currency: EUR
seller_name: John Doe
@ -10,30 +10,15 @@ DEFAULTS: &DEFAULTS
total: 16.50
reference_no: 13
valid:
<<: *DEFAULTS
exported:
<<: *DEFAULTS
in_directo: true
cancelled:
<<: *DEFAULTS
cancelled_at: <%= Date.parse '2010-07-05' %>
paid:
<<: *DEFAULTS
total: 1
outstanding:
<<: *DEFAULTS
due_date: <%= Date.parse '2010-07-04' %>
overdue:
<<: *DEFAULTS
due_date: <%= Date.parse '2010-07-03' %>
for_payments_test:
<<: *DEFAULTS
total: 12.00
number: 1
issue_date: <%= Date.parse '2010-07-05' %>
due_date: <%= Date.parse '2010-07-06' %>
currency: EUR
seller_name: John Doe
seller_iban: 1234
buyer: bestnames
buyer_name: Jane Doe
vat_rate: 0.1
reference_no: 13
total: 12.00