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
@@ -57,10 +57,10 @@ class SalesCommissionsTest < Redmine::IntegrationTest
|
||||
assert_select 'input[name=?][value=?][checked]', 'included[]', 'refund_receipt:3'
|
||||
assert_select 'input[name=?][value="2"][checked]', 'eligible[]'
|
||||
assert_select 'input[name=approve]'
|
||||
# Invoices open in Redmine, the refund receipt (no Redmine page) in QuickBooks
|
||||
# Invoices open in Redmine, the refund receipt (no Redmine page) as QuickBooks' PDF through Redmine
|
||||
assert_select '#sales-commission-sales a[href=?]', '/qbo_invoices/1/edit'
|
||||
assert_select '#sales-commission-sales a[href*="qbo.intuit.com"]', count: 0
|
||||
assert_select '#sales-commission-deductions a[href*="qbo.intuit.com/app/refundreceipt?txnId=3"]'
|
||||
assert_select '#sales-commission-deductions a[href=?]', '/sales_commission/pdf/refund_receipt/3'
|
||||
assert_select 'a[href*="qbo.intuit.com"]', count: 0
|
||||
end
|
||||
|
||||
def test_view_only
|
||||
@@ -181,4 +181,22 @@ class SalesCommissionsTest < Redmine::IntegrationTest
|
||||
post '/sales_commission/2026-10/refresh'
|
||||
assert_redirected_to '/sales_commission/2026-10'
|
||||
end
|
||||
|
||||
def test_txn_pdf
|
||||
RedmineQboCommission::Txn.expects(:pdf).with('credit_memo', '123').returns('%PDF-1.4 credit memo')
|
||||
log_user('admin', 'admin')
|
||||
get '/sales_commission/pdf/credit_memo/123'
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', response.media_type
|
||||
assert_equal '%PDF-1.4 credit memo', response.body
|
||||
get '/sales_commission/pdf/invoice/123'
|
||||
assert_response :not_found
|
||||
end
|
||||
|
||||
def test_txn_pdf_needs_approve
|
||||
Role.find(1).add_permission!(:view_sales_commission)
|
||||
log_user('jsmith', 'jsmith')
|
||||
get '/sales_commission/pdf/sales_receipt/5'
|
||||
assert_response :forbidden
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user