Skip to content

Commit

Permalink
Fix for update_pricing method:
Browse files Browse the repository at this point in the history
- Specify currency
- Handle case where quantity is zero
  • Loading branch information
SchrodingersGat committed Apr 22, 2024
1 parent 9a16a73 commit 6d63a98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/backend/InvenTree/order/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,9 +1459,11 @@ def remaining(self):
def update_pricing(self):
"""Update pricing information based on the supplier part data."""
if self.part:
price = self.part.get_price(self.quantity)
price = self.part.get_price(
self.quantity, currency=self.purchase_price_currency
)

if price is None:
if price is None or self.quantity == 0:
return

self.purchase_price = Decimal(price) / Decimal(self.quantity)
Expand Down

0 comments on commit 6d63a98

Please sign in to comment.