you can't add an existing invoice.
This commit is contained in:
@@ -13,6 +13,10 @@
|
||||
(vendors/insert {:name vendor-name :default-expense-account 0})))
|
||||
|
||||
(defn add-invoice [context {{:keys [total invoice_number location company_id vendor_id vendor_name date] :as in} :invoice} value]
|
||||
(when (seq (invoices/find-conflicting {:invoice-number invoice_number
|
||||
:vendor-id vendor_id
|
||||
:company-id company_id}))
|
||||
(throw (ex-info "that invoice already exists" {:invoice-number invoice_number})))
|
||||
(let [vendor (-create-or-get-vendor vendor_id vendor_name)
|
||||
_ (assert-can-see-company (:id context) company_id)
|
||||
company (companies/get-by-id company_id)
|
||||
|
||||
Reference in New Issue
Block a user