aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws/orders.py
diff options
context:
space:
mode:
Diffstat (limited to 'gsxws/orders.py')
-rw-r--r--gsxws/orders.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/gsxws/orders.py b/gsxws/orders.py
new file mode 100644
index 0000000..1687931
--- /dev/null
+++ b/gsxws/orders.py
@@ -0,0 +1,20 @@
+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
+
+ try:
+ result = CLIENT.service.CreateStockingOrder(dt)
+ return result.orderConfirmation
+ except suds.WebFault, e:
+ raise GsxError(fault=e)