2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-02 21:38:48 +00:00

Bug fix for attachment updating (#8362)

-  Closes https://github.com/inventree/InvenTree/issues/8354
This commit is contained in:
Oliver 2024-10-25 20:20:23 +11:00 committed by GitHub
parent 0ae9cdd39f
commit 5af0e50b79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -546,6 +546,10 @@ class AttachmentSerializer(InvenTreeModelSerializer):
model_type = self.validated_data.get('model_type', None)
# If the model type is not specified, attempt to infer it from the instance
if model_type is None and self.instance:
model_type = self.instance.model_type
# Ensure that the user has permission to attach files to the specified model
user = self.context.get('request').user