Improve selecting deliveries/orders when creating an invoice
When creating an invoice after balancing an order, it's not possible to the corresponding order. Change the elements in the select box to the latest ended/delivered items (which have not been assigned already) instead.
This commit is contained in:
parent
8fd484eda5
commit
d0e73ea1ff
1 changed files with 2 additions and 2 deletions
|
@ -32,8 +32,8 @@ class Finance::InvoicesController < ApplicationController
|
|||
end
|
||||
|
||||
def fill_deliveries_and_orders_collection(invoice_id, supplier_id)
|
||||
@deliveries_collection = Delivery.where('invoice_id = ? OR (invoice_id IS NULL AND supplier_id = ?)', invoice_id, supplier_id).order(:date)
|
||||
@orders_collection = Order.where('invoice_id = ? OR (invoice_id IS NULL AND supplier_id = ? AND state IN (?))', invoice_id, supplier_id, %w[finished received]).order(:ends)
|
||||
@deliveries_collection = Delivery.where('invoice_id = ? OR (invoice_id IS NULL AND supplier_id = ?)', invoice_id, supplier_id).order(date: :desc).limit(25)
|
||||
@orders_collection = Order.where('invoice_id = ? OR (invoice_id IS NULL AND supplier_id = ?)', invoice_id, supplier_id).order(ends: :desc).limit(25)
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
Loading…
Reference in a new issue