Allows resetting expense accounts

This commit is contained in:
2024-04-17 22:38:01 -07:00
parent 52662ca965
commit 705cab9435

View File

@@ -374,8 +374,12 @@
set
(conj "A")
(conj "HQ"))))]
(when-not (dollars= (Math/abs (:transaction/amount existing-transaction)) account-total)
(when (and (not (dollars= (Math/abs (:transaction/amount existing-transaction)) account-total))
(or
(and (= approval_status :unapproved)
(> (count accounts) 0))
(not= approval_status :unapproved)))
(let [error (str "Expense account total (" account-total ") does not equal transaction total (" (Math/abs (:transaction/amount existing-transaction)) ")")]
(throw (ex-info error {:validation-error error}))))
(when missing-locations