Add option to create a new FinancialTransaction at a FinancialLink

This commit is contained in:
Patrick Gansterer 2021-02-08 02:47:05 +01:00
parent 0e77a0e77c
commit a30d0d4453
8 changed files with 66 additions and 1 deletions

View file

@ -37,4 +37,8 @@ class FinancialLink < ApplicationRecord
def self.first_unused_or_create
unused.first || create
end
def amount
bank_transactions.sum(:amount) + invoices.sum(:amount) - financial_transactions.sum(:amount)
end
end