Sync invoice when viewing

This commit is contained in:
2022-02-20 19:37:03 -05:00
parent f3c5de82e0
commit 446f419af0

View File

@@ -23,5 +23,10 @@ class InvoiceController < ApplicationController
invoice = base.fetch_by_id(params[:id]) invoice = base.fetch_by_id(params[:id])
@pdf = base.pdf(invoice) @pdf = base.pdf(invoice)
send_data @pdf, filename: "invoice #{invoice.doc_number}.pdf", :disposition => 'inline', :type => "application/pdf" send_data @pdf, filename: "invoice #{invoice.doc_number}.pdf", :disposition => 'inline', :type => "application/pdf"
Thread.new do
QboInvoice.sync_by_id params[:id]
ActiveRecord::Base.connection.close
end
end end
end end