API: Fix event cloning, limit_sales_channels should never be set when all_sales_channels is set (Z#23169537)

This commit is contained in:
Raphael Michel
2024-10-23 16:29:33 +02:00
parent 22c36b89da
commit 19175258fd
3 changed files with 7 additions and 2 deletions

View File

@@ -369,7 +369,7 @@ class ItemSerializer(SalesChannelMigrationMixin, I18nAwareModelSerializer):
require_membership_types = validated_data.pop('require_membership_types', [])
limit_sales_channels = validated_data.pop('limit_sales_channels', [])
item = Item.objects.create(**validated_data)
if limit_sales_channels:
if limit_sales_channels and not validated_data.get('all_sales_channels'):
item.limit_sales_channels.add(*limit_sales_channels)
if picture:
item.picture.save(os.path.basename(picture.name), picture)