mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-21 05:09:15 +00:00
Set owner enterprise when creating source variant
This commit is contained in:
@@ -120,6 +120,8 @@ module Admin
|
||||
variant.price = source_variant.price
|
||||
variant.save!
|
||||
variant.source_variants << source_variant
|
||||
# Owner is my enterprise which has permission to create sourced variants from that supplier
|
||||
variant.owner_id = EnterpriseRelationship.permitted_by(source_variant.supplier).permitting(spree_current_user.enterprises).with_permission(:create_sourced_variants).pluck(:child_id).first
|
||||
variant.on_demand = source_variant.on_demand
|
||||
variant.on_hand = source_variant.on_hand
|
||||
variant.save!
|
||||
|
||||
Reference in New Issue
Block a user