Fix variant filtering

We don't want to filter out variant missing producer, so that the user
can address the problem.
This commit is contained in:
Gaetan Craig-Riou
2025-10-22 16:48:16 +11:00
parent ab443fa50f
commit e8b81c1ff6

View File

@@ -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: }