Merge pull request #10449 from macanudo527/fix_ER

Update OCs after ER Permissions are Revoked
This commit is contained in:
Filipe
2023-04-12 18:59:20 +01:00
committed by GitHub
5 changed files with 126 additions and 1 deletions

View File

@@ -11,6 +11,15 @@ class VariantDeleter
variant.destroy
end
def destroy_related_outgoing_variants(variant_id, order_cycle)
internal_variants = ExchangeVariant.where(variant_id: variant_id).
joins(:exchange).
where(
exchanges: { order_cycle: order_cycle, incoming: false }
)
internal_variants.destroy_all
end
private
def only_variant_on_product?(variant)