mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Include pricing information in part supplier view
Also some CSS tweaks to secondary modal buttons
This commit is contained in:
@ -81,7 +81,8 @@ class SupplierPartList(generics.ListCreateAPIView):
|
||||
'part__stock_items',
|
||||
'part__bom_items',
|
||||
'part__builds',
|
||||
'supplier')
|
||||
'supplier',
|
||||
'pricebreaks')
|
||||
|
||||
serializer_class = SupplierPartSerializer
|
||||
|
||||
|
@ -239,6 +239,10 @@ class SupplierPart(models.Model):
|
||||
""" Return the associated price breaks in the correct order """
|
||||
return self.pricebreaks.order_by('quantity').all()
|
||||
|
||||
@property
|
||||
def unit_pricing(self):
|
||||
return self.get_price(1)
|
||||
|
||||
def get_price(self, quantity, moq=True, multiples=True):
|
||||
""" Calculate the supplier price based on quantity price breaks.
|
||||
|
||||
|
@ -62,6 +62,8 @@ class SupplierPartSerializer(serializers.ModelSerializer):
|
||||
supplier_name = serializers.CharField(source='supplier.name', read_only=True)
|
||||
supplier_logo = serializers.CharField(source='supplier.get_image_url', read_only=True)
|
||||
|
||||
pricing = serializers.CharField(source='unit_pricing', read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = SupplierPart
|
||||
fields = [
|
||||
@ -76,6 +78,7 @@ class SupplierPartSerializer(serializers.ModelSerializer):
|
||||
'manufacturer',
|
||||
'MPN',
|
||||
'URL',
|
||||
'pricing',
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user