mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +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
16
lib/tasks/data_migrations/populate_invoice_issue_date.rake
Normal file
16
lib/tasks/data_migrations/populate_invoice_issue_date.rake
Normal file
|
@ -0,0 +1,16 @@
|
|||
namespace :data_migrations do
|
||||
task populate_invoice_issue_date: [:environment] do
|
||||
processed_invoice_count = 0
|
||||
|
||||
Invoice.transaction do
|
||||
Invoice.find_each do |invoice|
|
||||
invoice_issue_date = invoice.created_at.to_date
|
||||
invoice.update!(issue_date: invoice_issue_date)
|
||||
|
||||
processed_invoice_count += 1
|
||||
end
|
||||
end
|
||||
|
||||
puts "Invoices processed: #{processed_invoice_count}"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue