2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

Add 'user' field to attachment

This commit is contained in:
Oliver Walters
2020-05-12 20:50:03 +10:00
parent 2948dad831
commit d4fa7d936e
7 changed files with 99 additions and 1 deletions

View File

@ -193,6 +193,16 @@ class LocationSerializer(InvenTreeModelSerializer):
class StockItemAttachmentSerializer(InvenTreeModelSerializer):
""" Serializer for StockItemAttachment model """
def __init_(self, *args, **kwargs):
user_detail = kwargs.pop('user_detail', False)
super().__init__(*args, **kwargs)
if user_detail is not True:
self.fields.pop('user_detail')
user_detail = UserSerializerBrief(source='user', read_only=True)
class Meta:
model = StockItemAttachment
@ -200,7 +210,9 @@ class StockItemAttachmentSerializer(InvenTreeModelSerializer):
'pk',
'stock_item',
'attachment',
'comment'
'comment',
'user',
'user_detail',
]