Depend on redmine_qbo for estimate issues and labor hours

Billing has been folded into redmine_qbo 2026.11.0; the settings link now opens redmine_qbo's settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-30 23:49:17 -04:00
1 parent fc503fca68
commit 13e8c07c0d
10 files changed
+21 -27

No files matched your search

+5 -4
View File
@@ -12,7 +12,7 @@ This plugin allows for adding customer appointment capability to the Redmine cal
* **Parent Plugin:** [Redmine QuickBooks Online](https://github.com/rickbarrette/redmine_qbo) (must be installed and configured) * **Parent Plugin:** [Redmine QuickBooks Online](https://github.com/rickbarrette/redmine_qbo) (must be installed and configured)
* **Billing Plugin:** [Redmine QuickBooks Billing](https://github.com/rickbarrette/redmine_qbo_billing). It creates issues from an appointment's estimate and works out the estimate's labor hours. * Version 2026.11.0 or newer of redmine_qbo: it creates issues from an appointment's estimate and works out the estimate's labor hours.
--- ---
@@ -21,6 +21,7 @@ This plugin allows for adding customer appointment capability to the Redmine cal
| Plugin Version | Redmine Version | Parent Plugin Version | | Plugin Version | Redmine Version | Parent Plugin Version |
| --- | --- | --- | | --- | --- | --- |
| 2026.8.0+ | 7.0.x | 2026.8.0+ | | 2026.8.0+ | 7.0.x | 2026.8.0+ |
| 2026.10.0+ | 7.0.x | 2026.11.0+ |
--- ---
@@ -28,9 +29,9 @@ This plugin allows for adding customer appointment capability to the Redmine cal
Add appointments to the redmine calanedar with the abiltiy to attach a QBO customer, QBO Vehicle, QBO Estimate, ect. Add appointments to the redmine calanedar with the abiltiy to attach a QBO customer, QBO Vehicle, QBO Estimate, ect.
* An appointment's hours can't be less than its estimate's labor hours (the lines matching redmine_qbo_billing's estimate item codes). Picking an estimate raises the hours to match. * An appointment's hours can't be less than its estimate's labor hours (the lines matching redmine_qbo's estimate item codes). Picking an estimate raises the hours to match.
* The appointment page lists the issues linked to its estimate, and **Create Issues from Estimate** opens redmine_qbo_billing's Create issues page with the appointment's dates, technician and vehicle. * The appointment page lists the issues linked to its estimate, and **Create Issues from Estimate** opens redmine_qbo's Create issues page with the appointment's dates, technician and vehicle.
* Estimate pages in redmine_qbo_billing get an **Add appointment** link. * Estimate pages in redmine_qbo get an **Add appointment** link.
--- ---
@@ -24,7 +24,7 @@ class CustomerAppointmentsController < ApplicationController
} }
end end
# The estimate's labor hours (redmine_qbo_billing's item codes), so the form can make sure the # The estimate's labor hours (redmine_qbo's item codes), so the form can make sure the
# appointment's hours aren't less # appointment's hours aren't less
def estimate_hours def estimate_hours
estimate = Estimate.find_by(id: params[:estimate_id]) estimate = Estimate.find_by(id: params[:estimate_id])
@@ -109,7 +109,7 @@ class CustomerAppointmentsController < ApplicationController
private private
# Links from an estimate (redmine_qbo_billing) pass the estimate and vehicle; each is used only when it # Links from an estimate (redmine_qbo) pass the estimate and vehicle; each is used only when it
# belongs to the appointment's customer # belongs to the appointment's customer
def prefill_estimate_and_vehicle def prefill_estimate_and_vehicle
customer = @appointment.customer customer = @appointment.customer
+1 -1
View File
@@ -81,7 +81,7 @@ class CustomerAppointment < ActiveRecord::Base
end end
# The estimate's labor hours rounded up to whole hours (appointment hours are whole numbers): the # The estimate's labor hours rounded up to whole hours (appointment hours are whole numbers): the
# quantities of its lines whose item matches redmine_qbo_billing's item codes (e.g. Labor). 0 if the # quantities of its lines whose item matches redmine_qbo's item codes (e.g. Labor). 0 if the
# estimate can't be read from QuickBooks. # estimate can't be read from QuickBooks.
def self.estimate_labor_hours(estimate) def self.estimate_labor_hours(estimate)
return 0 if estimate.nil? return 0 if estimate.nil?
@@ -1,4 +1,4 @@
<%# Add appointment link on an estimate's page (redmine_qbo_billing) %> <%# Add appointment link on an estimate's page (redmine_qbo) %>
<% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %> <% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
<% vehicle = customer.vehicles.detect { |v| v.vin.to_s.casecmp?(vin.to_s.strip) } if vin.present? && customer.respond_to?(:vehicles) %> <% vehicle = customer.vehicles.detect { |v| v.vin.to_s.casecmp?(vin.to_s.strip) } if vin.present? && customer.respond_to?(:vehicles) %>
<%= link_to sprite_icon('time-add', l(:label_add_appointment)), <%= link_to sprite_icon('time-add', l(:label_add_appointment)),
@@ -14,7 +14,7 @@
<% end %> <% end %>
<% end %> <% end %>
<%# Issues from the estimate are made by redmine_qbo_billing, with this appointment's dates, technician and vehicle %> <%# Issues from the estimate are made by redmine_qbo, with this appointment's dates, technician and vehicle %>
<% if @appointment.estimate && User.current.allowed_to?(:create_estimate_issues, nil, global: true) %> <% if @appointment.estimate && User.current.allowed_to?(:create_estimate_issues, nil, global: true) %>
<%= link_to issues_preview_qbo_estimate_path(@appointment.estimate_id, appointment_id: @appointment.id) do %> <%= link_to issues_preview_qbo_estimate_path(@appointment.estimate_id, appointment_id: @appointment.id) do %>
<i class="fa-solid fa-list-check"></i> <%= l(:button_create_issues_from_estimate) %> <i class="fa-solid fa-list-check"></i> <%= l(:button_create_issues_from_estimate) %>
@@ -1,5 +1,5 @@
<%# The issues-from-estimate settings moved to redmine_qbo_billing %> <%# The issues-from-estimate settings moved to redmine_qbo %>
<p> <p>
<%= l(:text_estimate_issue_settings_moved) %> <%= l(:text_estimate_issue_settings_moved) %>
<%= link_to l(:label_redmine_qbo_billing_settings), plugin_settings_path(id: 'redmine_qbo_billing') %> <%= link_to l(:label_redmine_qbo_settings), plugin_settings_path(id: 'redmine_qbo') %>
</p> </p>
+2 -2
View File
@@ -88,5 +88,5 @@ en:
title_customer_appointments: Customer Appointments title_customer_appointments: Customer Appointments
error_hours_less_than_estimate: "The hours can't be less than the %{hours} labor hours on estimate #%{estimate}" error_hours_less_than_estimate: "The hours can't be less than the %{hours} labor hours on estimate #%{estimate}"
label_estimate_issues: "Issues for estimate #%{estimate}" label_estimate_issues: "Issues for estimate #%{estimate}"
label_redmine_qbo_billing_settings: "Redmine QBO Billing settings" label_redmine_qbo_settings: "Redmine QBO settings (Billing)"
text_estimate_issue_settings_moved: "Creating issues from estimates moved to redmine_qbo_billing: the item codes, default project and default tracker are set there." text_estimate_issue_settings_moved: "Creating issues from estimates moved to redmine_qbo: the item codes, default project and default tracker are set there."
+5 -12
View File
@@ -20,7 +20,7 @@ Redmine::Plugin.register :redmine_qbo_calendar do
requires_redmine version_or_higher: '7.0.0' requires_redmine version_or_higher: '7.0.0'
# Item codes: which QBO estimate items can become issues (e.g. Labor, Alignments) # Item codes: which QBO estimate items can become issues (e.g. Labor, Alignments)
# The issues-from-estimate settings moved to redmine_qbo_billing, which reads these old values until its # The issues-from-estimate settings moved to redmine_qbo, which reads these old values until its
# own are saved, so they're still registered here # own are saved, so they're still registered here
settings default: { 'item_codes' => "Labor", 'default_tracker_id' => '', 'default_project_id' => '' }, settings default: { 'item_codes' => "Labor", 'default_tracker_id' => '', 'default_project_id' => '' },
partial: 'settings/qbo_calendar_settings' partial: 'settings/qbo_calendar_settings'
@@ -28,28 +28,21 @@ Redmine::Plugin.register :redmine_qbo_calendar do
# Add Holidays index to the Redmine Administration Menu # Add Holidays index to the Redmine Administration Menu
menu :admin_menu, :holidays, { controller: 'holidays', action: 'index' }, caption: :label_holiday_plural, html: { class: 'icon icon-list' } menu :admin_menu, :holidays, { controller: 'holidays', action: 'index' }, caption: :label_holiday_plural, html: { class: 'icon icon-list' }
# Ensure redmine_qbo is installed # Ensure redmine_qbo is installed: creating issues from estimates and estimate labor hours live there
# (from 2026.11.0)
begin begin
requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.8.2' requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.11.0'
rescue Redmine::PluginNotFound rescue Redmine::PluginNotFound
raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)' raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)'
end end
# Creating issues from estimates and estimate labor hours live in redmine_qbo_billing (it sorts before this
# plugin, so Redmine has already loaded it)
begin
requires_redmine_plugin :redmine_qbo_billing, version_or_higher: '2026.10.0'
rescue Redmine::PluginNotFound
raise 'Please install the redmine_qbo_billing plugin (https://github.com/rickbarrette/redmine_qbo_billing)'
end
# Global Permissions # Global Permissions
permission :view_customer_appointments, { customer_appointments: [:index, :show, :history] }, global: true permission :view_customer_appointments, { customer_appointments: [:index, :show, :history] }, global: true
# customer_options feeds the vehicle/estimate dropdowns on the new and edit forms # customer_options feeds the vehicle/estimate dropdowns on the new and edit forms
permission :add_customer_appointments, { customer_appointments: [:new, :create, :customer_options, :estimate_hours] }, global: true permission :add_customer_appointments, { customer_appointments: [:new, :create, :customer_options, :estimate_hours] }, global: true
permission :edit_customer_appointments, { customer_appointments: [:edit, :update, :customer_options, :estimate_hours] }, global: true permission :edit_customer_appointments, { customer_appointments: [:edit, :update, :customer_options, :estimate_hours] }, global: true
permission :delete_customer_appointments, { customer_appointments: [:destroy] }, global: true permission :delete_customer_appointments, { customer_appointments: [:destroy] }, global: true
# Creating issues from an appointment's estimate is redmine_qbo_billing's "Create issues from estimates" # Creating issues from an appointment's estimate is redmine_qbo's "Create issues from estimates"
# Register top menu items # Register top menu items
menu :top_menu, :calendar, { controller: :calendars, action: :show }, caption: :label_calendar, if: Proc.new {User.current.logged?} menu :top_menu, :calendar, { controller: :calendars, action: :show }, caption: :label_calendar, if: Proc.new {User.current.logged?}
@@ -11,7 +11,7 @@
module RedmineQboCalendar module RedmineQboCalendar
module Hooks module Hooks
# Hooks for redmine_qbo_billing # Hooks for redmine_qbo's billing
class BillingHookListener < Redmine::Hook::Listener class BillingHookListener < Redmine::Hook::Listener
# "Create issues" opened from an appointment (?appointment_id=): the issues get the appointment's dates, # "Create issues" opened from an appointment (?appointment_id=): the issues get the appointment's dates,
@@ -20,7 +20,7 @@ module RedmineQboCalendar
locals: { customer: context[:customer] }) locals: { customer: context[:customer] })
end end
# Adds "Add appointment" to an estimate's page in redmine_qbo_billing (:view_qbo_estimate_contextual), # Adds "Add appointment" to an estimate's page in redmine_qbo (:view_qbo_estimate_contextual),
# with the customer, the estimate and the vehicle matching its VIN filled in # with the customer, the estimate and the vehicle matching its VIN filled in
def view_qbo_estimate_contextual(context = {}) def view_qbo_estimate_contextual(context = {})
customer = Customer.find_by(id: context[:customer_id]) customer = Customer.find_by(id: context[:customer_id])