Skip to content

Commit

Permalink
Fix for update_pricing method: (#7075)
Browse files Browse the repository at this point in the history
- Specify currency
- Handle case where quantity is zero

(cherry picked from commit 50ca493)
  • Loading branch information
SchrodingersGat committed Apr 22, 2024
1 parent b32f081 commit 0d7f60f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions InvenTree/order/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,9 +1447,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 0d7f60f

Please sign in to comment.