forked from erp-dev/erp
fix: added product_name for sales order api
This commit is contained in:
@@ -10,13 +10,14 @@ from api_v1.views.stock_change_views.mixins import StockChangeViewMixin
|
||||
|
||||
class SalesOrderItemSerializer(serializers.ModelSerializer):
|
||||
quantity_of_rolls = serializers.SerializerMethodField(read_only=True)
|
||||
product_name = serializers.CharField(source='product.name', read_only=True)
|
||||
def get_quantity_of_rolls(self, obj: business_models.SalesOrderItem):
|
||||
return obj.split_quantity_of_rolls()
|
||||
|
||||
class Meta:
|
||||
model = business_models.SalesOrderItem
|
||||
fields = [
|
||||
'id', 'product', 'price', 'color', 'quantity', 'unit',
|
||||
'id', 'product', 'product_name', 'price', 'color', 'quantity', 'unit',
|
||||
'empty_diff_percent', 'quantity_of_rolls', 'num_of_rolls',
|
||||
'consume_detail_ids', 'batch_number', 'order_quantity', 'remarks', 'created_at', 'updated_at', 'spec',
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user