Skip to content

Commit

Permalink
Add order status update functions
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed Aug 7, 2024
1 parent 0eddcb6 commit 8bd1af6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inventree/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ class Build(
URL = 'build'
MODEL_TYPE = 'build'

def issue(self):
"""Mark this build as 'issued'."""
return self._statusupdate(status='issue')

def hold(self):
"""Mark this build as 'on hold'."""
return self._statusupdate(status='hold')

def complete(
self,
accept_overallocated='reject',
Expand Down
8 changes: 8 additions & 0 deletions inventree/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def issue(self, **kwargs):
# Return
return self._statusupdate(status='issue', **kwargs)

def hold(self, **kwargs):
"""
Hold the purchase order
"""

# Return
return self._statusupdate(status='hold', **kwargs)

def receiveAll(self, location, status=10):
"""
Receive all of the purchase order items, into the given location.
Expand Down
4 changes: 4 additions & 0 deletions inventree/return_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def issue(self, **kwargs):
"""Issue (send) this order"""
return self._statusupdate(status='issue', **kwargs)

def hold(self, **kwargs):
"""Place this order on hold"""
return self._statusupdate(status='hold', **kwargs)

def cancel(self, **kwargs):
"""Cancel this order"""
return self._statusupdate(status='cancel', **kwargs)
Expand Down
12 changes: 12 additions & 0 deletions inventree/sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ def addShipment(self, reference, **kwargs):

return SalesOrderShipment.create(self._api, data=kwargs)

def issue(self, **kwargs):
"""Issue (send) this order"""
return self._statusupdate(status='issue', **kwargs)

def hold(self, **kwargs):
"""Place this order on hold"""
return self._statusupdate(status='hold', **kwargs)

def cancel(self, **kwargs):
"""Cancel this order"""
return self._statusupdate(status='cancel', **kwargs)


class SalesOrderLineItem(
inventree.base.InventreeObject,
Expand Down

0 comments on commit 8bd1af6

Please sign in to comment.