diff --git a/modules/features/automation/interfaceFeatureAutomation.py b/modules/features/automation/interfaceFeatureAutomation.py index 79fbd8ad..3b20ca3d 100644 --- a/modules/features/automation/interfaceFeatureAutomation.py +++ b/modules/features/automation/interfaceFeatureAutomation.py @@ -791,20 +791,23 @@ class AutomationObjects: if not self.checkRbacPermission(AutomationDefinition, "create"): raise PermissionError("No permission to create definitions") + # getAutomationDefinition returns Pydantic model; convert to dict for .get() access + existing_data = existing.model_dump() if hasattr(existing, "model_dump") else existing + # Build duplicate data duplicateData = { "id": str(uuid.uuid4()), - "mandateId": existing.get("mandateId"), - "featureInstanceId": existing.get("featureInstanceId"), - "label": f"{existing.get('label', '')} (Kopie)", - "schedule": existing.get("schedule", ""), - "template": existing.get("template", ""), - "placeholders": existing.get("placeholders", {}), + "mandateId": existing_data.get("mandateId"), + "featureInstanceId": existing_data.get("featureInstanceId"), + "label": f"{existing_data.get('label', '')} (Kopie)", + "schedule": existing_data.get("schedule", ""), + "template": existing_data.get("template", ""), + "placeholders": existing_data.get("placeholders", {}), "active": False, "eventId": None, "status": None, "executionLogs": [], - "allowedProviders": existing.get("allowedProviders", []), + "allowedProviders": existing_data.get("allowedProviders", []), } # Ensure database connector has correct userId context