Add method to close all invoices with an invoice direct

When the charge_members_manually option is active there is no need for an
explicit balancing step. This new function allows to close_direct all
orders which have an assigned invoice, which is usually indication enough
to find orders which can be closed finally.
This commit is contained in:
Patrick Gansterer 2020-02-28 12:17:27 +01:00
parent 226d2dda74
commit ecb4a8a4ba
6 changed files with 31 additions and 5 deletions

View file

@ -34,6 +34,7 @@ class Order < ApplicationRecord
scope :stockit, -> { where(supplier_id: 0).order('ends DESC') }
scope :recent, -> { order('starts DESC').limit(10) }
scope :stock_group_order, -> { group_orders.where(ordergroup_id: nil).first }
scope :with_invoice, -> { where.not(invoice: nil) }
# Allow separate inputs for date and time
# with workaround for https://github.com/einzige/date_time_attribute/issues/14