From 2f9ef6304fac34860541bc2ab7c5fde140e8e5df Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 16 Feb 2026 18:53:29 -0500 Subject: [PATCH] scope.includes(:customer) --- lib/redmine_qbo/patches/query_patch.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/redmine_qbo/patches/query_patch.rb b/lib/redmine_qbo/patches/query_patch.rb index 8c657af..6be9c51 100644 --- a/lib/redmine_qbo/patches/query_patch.rb +++ b/lib/redmine_qbo/patches/query_patch.rb @@ -16,12 +16,17 @@ module RedmineQbo def base_scope scope = super + if filters['customer_name'].present? scope = scope.left_outer_joins(:customer) end + + if has_column?(:customer) || filters['customer_name'].present? + scope = scope.includes(:customer) + end + scope end - # Add qbo options to the aviable columns def available_columns