mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
Fix for update_pricing method: (#7075)
- Specify currency - Handle case where quantity is zero
This commit is contained in:
parent
9a16a73ad3
commit
50ca493667
@ -1459,9 +1459,11 @@ class PurchaseOrderLineItem(OrderLineItem):
|
|||||||
def update_pricing(self):
|
def update_pricing(self):
|
||||||
"""Update pricing information based on the supplier part data."""
|
"""Update pricing information based on the supplier part data."""
|
||||||
if self.part:
|
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
|
return
|
||||||
|
|
||||||
self.purchase_price = Decimal(price) / Decimal(self.quantity)
|
self.purchase_price = Decimal(price) / Decimal(self.quantity)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user