Merge branch 'registry-772' into registry-623

# Conflicts:
#	app/models/invoice.rb
#	db/structure.sql
This commit is contained in:
Artur Beljajev 2018-03-10 16:48:47 +02:00
commit 7acd41595c
10 changed files with 29 additions and 12 deletions

View file

@ -3,7 +3,7 @@ class Directo < ActiveRecord::Base
belongs_to :item, polymorphic: true
def self.send_receipts
new_trans = Invoice.where(invoice_type: "DEB", in_directo: false).where(cancelled_at: nil)
new_trans = Invoice.where(in_directo: false).where(cancelled_at: nil)
total = new_trans.count
counter = 0
Rails.logger.info("[DIRECTO] Will try to send #{total} invoices")

View file

@ -27,7 +27,7 @@ class Invoice < ActiveRecord::Base
attr_accessor :billing_email
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
validates :invoice_type, :due_date, :currency, :seller_name,
validates :due_date, :currency, :seller_name,
:seller_iban, :buyer_name, :invoice_items, :vat_rate, presence: true
validates :vat_rate, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 99 }, allow_nil: true

View file

@ -67,7 +67,6 @@ class Registrar < ActiveRecord::Base
end
invoices.create(
invoice_type: 'DEB',
due_date: (Time.zone.now.to_date + Setting.days_to_keep_invoices_active.days).end_of_day,
payment_term: 'prepayment',
description: description,