Receipts and credit memos open QuickBooks' PDF through Redmine
Sales receipts, refund receipts and credit memos on the commission page link to their QuickBooks PDF, fetched by Redmine (approvers only), so nothing on the page opens QuickBooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9501216525
commit
e76bd12b7f
7 files changed
+57
-15
No files matched your search
@@ -16,7 +16,7 @@ class SalesCommissionsController < ApplicationController
|
||||
menu_item :sales_commissions
|
||||
|
||||
before_action :authorize_global
|
||||
before_action :find_month, except: [:index, :current]
|
||||
before_action :find_month, except: [:index, :current, :txn_pdf]
|
||||
before_action :find_open_record, only: [:update, :add_adjustment, :remove_adjustment]
|
||||
|
||||
helper :sales_commissions
|
||||
@@ -120,6 +120,19 @@ class SalesCommissionsController < ApplicationController
|
||||
render_404
|
||||
end
|
||||
|
||||
# QuickBooks' PDF of a sales receipt, refund receipt or credit memo, shown in the browser
|
||||
def txn_pdf
|
||||
pdf = RedmineQboCommission::Txn.pdf(params[:kind], params[:txn_id])
|
||||
send_data pdf, type: 'application/pdf', disposition: 'inline',
|
||||
filename: "#{params[:kind].to_s.dasherize}-#{params[:txn_id].to_i}.pdf"
|
||||
rescue KeyError
|
||||
render_404
|
||||
rescue StandardError => e
|
||||
Rails.logger.error "[redmine_qbo_commission] PDF of #{params[:kind]} #{params[:txn_id]}: #{e.message}"
|
||||
flash[:error] = l(:error_sales_commission_qbo, error: e.message)
|
||||
redirect_back_or_default sales_commissions_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_month
|
||||
|
||||
Reference in new issue
Block a user