From e8b81c1ff68ef17a5ca7f582e76a63bfb3f77059 Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Wed, 22 Oct 2025 16:48:16 +1100 Subject: [PATCH] Fix variant filtering We don't want to filter out variant missing producer, so that the user can address the problem. --- app/views/admin/products_v3/_product_variant_row.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/admin/products_v3/_product_variant_row.html.haml b/app/views/admin/products_v3/_product_variant_row.html.haml index 616eb8268f..c2869deb3f 100644 --- a/app/views/admin/products_v3/_product_variant_row.html.haml +++ b/app/views/admin/products_v3/_product_variant_row.html.haml @@ -9,7 +9,8 @@ - product.variants.each_with_index do |variant, variant_index| - - next unless allowed_producers.include?(variant.supplier) + -# Filter out variant a user has not permission to update, but keep variant with no supplier + - next if variant.supplier.present? && !allowed_producers.include?(variant.supplier) = form.fields_for("products][#{product_index}][variants_attributes", variant, index: variant_index) do |variant_form| %tr.condensed{ id: dom_id(variant), 'data-controller': "variant", 'class': "nested-form-wrapper", 'data-new-record': variant.new_record? ? "true" : false } = render partial: 'variant_row', locals: { variant:, f: variant_form, category_options:, tax_category_options:, producer_options: }