diff options
author | Filipp Lepalaan <f@0x00.co> | 2013-01-13 21:40:06 +0200 |
---|---|---|
committer | Filipp Lepalaan <f@0x00.co> | 2013-01-13 21:40:06 +0200 |
commit | 57b85ab316789273d40f1ee5722f54d082bc3680 (patch) | |
tree | a6c50c6808dd21f18e6b02f7a835b1dc46b25298 | |
parent | 42cf29d8dfbb6eda26d733dbd1138fb392d3ff2a (diff) | |
download | py-gsxws-57b85ab316789273d40f1ee5722f54d082bc3680.tar.gz py-gsxws-57b85ab316789273d40f1ee5722f54d082bc3680.tar.bz2 py-gsxws-57b85ab316789273d40f1ee5722f54d082bc3680.zip |
Implement creating stocking orders
-rwxr-xr-x | gsx.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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) |