mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-18 02:20:37 -05:00
Cache totals, man-hours and payments; add a business report
- Estimates now keep their total; estimates and invoices keep their man-hours: the quantities of the products/services set as "Replaced by imported time" (bundles included; the estimate item codes while that setting is blank). Filled in by the webhook and the sync. - Payment model (QboBaseModel) caching each payment's customer, date, amount and unapplied amount, kept current by the webhook, the sync and the Receive payment page. - Business report (View business reports permission, top menu): estimates written vs. invoices written vs. payments received, and estimated hours on estimates and issues vs. invoiced and spent hours, for a period, with a month-by-month breakdown. - Fix two keyword arguments that defaulted to themselves (QboSyncDispatcher.enque_jobs, PdfService), which newer Ruby refuses to parse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
20 files changed
+590
-5
No files matched your search
@@ -100,8 +100,9 @@ module RedmineQboBilling
|
||||
saved = with_service('Payment') { |service| service.create(payment) }
|
||||
raise Error, I18n.t(:error_payment_not_saved) unless saved
|
||||
|
||||
# Invoice balances changed: update the local invoices
|
||||
# Invoice balances changed: update the local invoices, and cache the payment for reports
|
||||
applied.each { |invoice, _| sync_invoice(invoice[:id]) }
|
||||
sync_payment(saved.id)
|
||||
saved
|
||||
end
|
||||
|
||||
@@ -149,6 +150,12 @@ module RedmineQboBilling
|
||||
QboConnectionService.with_qbo_service(entity: entity, &block)
|
||||
end
|
||||
|
||||
def sync_payment(id)
|
||||
PaymentSyncService.new.sync_by_id(id)
|
||||
rescue StandardError => e
|
||||
Rails.logger.warn "[RedmineQboBilling] Could not cache payment #{id}: #{e.message}"
|
||||
end
|
||||
|
||||
def sync_invoice(id)
|
||||
InvoiceSyncService.new.sync_by_id(id)
|
||||
rescue StandardError => e
|
||||
|
||||
Reference in new issue
Block a user