mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improve logic of "quantity_to_order" function
This commit is contained in:
parent
8ac23c080f
commit
3d245c7ce3
@ -594,7 +594,16 @@ class Part(MPTTModel):
|
|||||||
def quantity_to_order(self):
|
def quantity_to_order(self):
|
||||||
""" Return the quantity needing to be ordered for this part. """
|
""" Return the quantity needing to be ordered for this part. """
|
||||||
|
|
||||||
required = -1 * self.net_stock
|
# How many do we need to have "on hand" at any point?
|
||||||
|
required = self.net_stock - self.minimum_stock
|
||||||
|
|
||||||
|
if required < 0:
|
||||||
|
return abs(required)
|
||||||
|
|
||||||
|
# Do not need to order any
|
||||||
|
return 0
|
||||||
|
|
||||||
|
required = self.net_stock
|
||||||
return max(required, 0)
|
return max(required, 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
Reference in New Issue
Block a user