diff options
Diffstat (limited to 'servo/models/order.py')
-rw-r--r-- | servo/models/order.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/servo/models/order.py b/servo/models/order.py index 18fc3b0..b389053 100644 --- a/servo/models/order.py +++ b/servo/models/order.py @@ -931,8 +931,12 @@ class ServiceOrderItem(AbstractOrderItem): return self.order.repair_set.latest() def reserve_product(self): + """ + Reserve this SOI for the inventory at this location + """ location = self.order.location - inventory = Inventory.objects.get(location=location, product=self.product) + inventory, created = Inventory.objects.get_or_create(location=location, + product=self.product) inventory.amount_reserved += self.amount inventory.save() |