aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@0x00.co>2013-01-13 21:40:06 +0200
committerFilipp Lepalaan <f@0x00.co>2013-01-13 21:40:06 +0200
commit57b85ab316789273d40f1ee5722f54d082bc3680 (patch)
treea6c50c6808dd21f18e6b02f7a835b1dc46b25298
parent42cf29d8dfbb6eda26d733dbd1138fb392d3ff2a (diff)
downloadpy-gsxws-57b85ab316789273d40f1ee5722f54d082bc3680.tar.gz
py-gsxws-57b85ab316789273d40f1ee5722f54d082bc3680.tar.bz2
py-gsxws-57b85ab316789273d40f1ee5722f54d082bc3680.zip
Implement creating stocking orders
-rwxr-xr-xgsx.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gsx.py b/gsx.py
index affdc30..f6c69f7 100755
--- a/gsx.py
+++ b/gsx.py
@@ -188,6 +188,21 @@ class Diagnostics(GsxObject):
else:
self.set_request('ns3:fetchRepairDiagnosticRequestType', 'lookupRequestData')
+class Order(GsxObject):
+ def __init__(self, type='stocking', *args, **kwargs):
+ super(Order, self).__init__(*args, **kwargs)
+ self.data['orderLines'] = list()
+
+ def add_part(self, part_number, quantity):
+ self.data['orderLines'].append({'partNumber': part_number, 'quantity': quantity})
+
+ def submit(self):
+ dt = CLIENT.factory.create('ns1:createStockingOrderRequestType')
+ dt.userSession = SESSION
+ dt.orderData = self.data
+ result = CLIENT.service.CreateStockingOrder(dt)
+ return result.orderConfirmation
+
class Returns(GsxObject):
def __init__(self, order_number=None, *args, **kwargs):
super(Returns, self).__init__(*args, **kwargs)