mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-17 18:20:36 -05:00
Show estimate, invoice and payment activity on the activity page
Each type appears only on the overall activity page, and only for users who may see it: estimates need View customers or Write estimates, invoices View customers or Write invoices, and payments View or Receive payments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dbee228cdf
commit
159420fac1
10 files changed
+185
No files matched your search
@@ -18,6 +18,19 @@ class Payment < QboBaseModel
|
||||
self.primary_key = :id
|
||||
qbo_sync push: false
|
||||
|
||||
include QboActivity
|
||||
qbo_activity 'qbo_payments', icon: 'qbo-payment', permissions: %i[view_payments receive_payments],
|
||||
title: ->(p) { I18n.t(:label_activity_payment, customer: p.activity_customer, amount: p.activity_money(p.total_amount)) },
|
||||
description: ->(p) { p.activity_description },
|
||||
url: ->(p) { { controller: 'qbo_payments', action: 'show', id: p.id } }
|
||||
|
||||
# Money not yet applied to an invoice, when there is some
|
||||
def activity_description
|
||||
return '' unless unapplied_amount.to_d.positive?
|
||||
|
||||
I18n.t(:text_activity_payment_unapplied, amount: activity_money(unapplied_amount))
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{txn_date} #{total_amount}"
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user