Adopt model to allow FinancialTransaction without an ordergroup

This will allow us to add accounting for the foodcoop itself, to support
listing for spendings independent of the order (e.g. rent, electricity).
This commit is contained in:
Patrick Gansterer 2019-11-01 14:07:23 +01:00
parent 1053b3883d
commit 1a49bee42d
11 changed files with 22 additions and 7 deletions

View file

@ -2,7 +2,7 @@ class Finance::BaseController < ApplicationController
before_action :authenticate_finance
def index
@financial_transactions = FinancialTransaction.includes(:ordergroup).order('created_on DESC').limit(8)
@financial_transactions = FinancialTransaction.with_ordergroup.includes(:ordergroup).order(created_on: :desc).limit(8)
@orders = Order.finished_not_closed.includes(:supplier).limit(8)
@unpaid_invoices = Invoice.unpaid.includes(:supplier).limit(8)