mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 21:25:42 +00:00 
			
		
		
		
	only process purchase_price if prices present
This commit is contained in:
		| @@ -1652,8 +1652,10 @@ class Part(MPTTModel): | |||||||
|  |  | ||||||
|     def get_purchase_price(self, quantity): |     def get_purchase_price(self, quantity): | ||||||
|         currency = currency_code_default() |         currency = currency_code_default() | ||||||
|         prices = [convert_money(item.purchase_price, currency).amount for item in self.stock_items.all()] |         prices = [convert_money(item.purchase_price, currency).amount for item in self.stock_items.all() if item.purchase_price] | ||||||
|         return min(prices) * quantity, max(prices) * quantity |         if prices: | ||||||
|  |             return min(prices) * quantity, max(prices) * quantity | ||||||
|  |         return None | ||||||
|  |  | ||||||
|     @transaction.atomic |     @transaction.atomic | ||||||
|     def copy_bom_from(self, other, clear=True, **kwargs): |     def copy_bom_from(self, other, clear=True, **kwargs): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user