change my distributions to assigner & assigned by param
This commit is contained in:
@@ -47,10 +47,13 @@ class InventoryEntrySerializer(serializers.ModelSerializer):
|
||||
return attrs
|
||||
|
||||
def to_representation(self, instance):
|
||||
""" custom output of inventory entry serializer """
|
||||
|
||||
representation = super().to_representation(instance)
|
||||
if instance.document:
|
||||
representation['document'] = instance.document
|
||||
if instance.distribution:
|
||||
# distribution data
|
||||
representation['distribution'] = {
|
||||
'distribution': instance.distribution.distribution_id,
|
||||
'sale_unit': instance.distribution.quota.sale_unit.unit,
|
||||
|
||||
Reference in New Issue
Block a user