2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00

Remove get_internal_price method

This commit is contained in:
Oliver Walters
2023-02-21 21:29:19 +11:00
parent b96787aa6e
commit 7c9ad4ff7f
2 changed files with 0 additions and 16 deletions

View File

@ -1758,10 +1758,6 @@ class Part(InvenTreeBarcodeMixin, MetadataMixin, MPTTModel):
Returns:
Minimum of the supplier, BOM, internal or purchase price. If no pricing available, returns None
"""
# only get internal price if set and should be used
if internal and self.has_internal_price_breaks:
internal_price = self.get_internal_price(quantity)
return internal_price, internal_price
# only get purchase price if set and should be used
if purchase:
@ -1822,10 +1818,6 @@ class Part(InvenTreeBarcodeMixin, MetadataMixin, MPTTModel):
price=price
)
def get_internal_price(self, quantity, moq=True, multiples=True, currency=None):
"""Return the internal price of this Part at the specified quantity"""
return common.models.get_price(self, quantity, moq, multiples, currency, break_name='internal_price_breaks')
@property
def has_internal_price_breaks(self):
"""Return True if this Part has internal pricing information"""

View File

@ -263,14 +263,6 @@ class PartTest(TestCase):
self.assertEqual(float(self.r1.get_price(1)), 0.15)
self.assertEqual(float(self.r1.get_price(10)), 1.0)
def test_internal_pricing(self):
"""Check that the sell pricebreaks were loaded"""
self.assertTrue(self.r1.has_internal_price_breaks)
self.assertEqual(self.r1.internal_price_breaks.count(), 2)
# check that the sell pricebreaks work
self.assertEqual(float(self.r1.get_internal_price(1)), 0.08)
self.assertEqual(float(self.r1.get_internal_price(10)), 0.5)
def test_metadata(self):
"""Unit tests for the Part metadata field."""
p = Part.objects.get(pk=1)