From 6d63a98d4cd6b803c468f086a0a30f1f6526a505 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 22 Apr 2024 03:17:36 +0000 Subject: [PATCH] Fix for update_pricing method: - Specify currency - Handle case where quantity is zero --- src/backend/InvenTree/order/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/InvenTree/order/models.py b/src/backend/InvenTree/order/models.py index f33fcd53ab0d..94710c01a9a7 100644 --- a/src/backend/InvenTree/order/models.py +++ b/src/backend/InvenTree/order/models.py @@ -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)