To create the order with the API is a two part you need to create the header then the lines all individually.
The python code to do this is:
Code:
OrderHeaderDetails['deliverydate'] = OrderHeaderDetails['orddate']
OrderHeaderDetails['confirmeddate'] = OrderHeaderDetails['orddate']
OrderHeaderDetails['datepackingslipprinted'] = OrderHeaderDetails['orddate']
OrderHeaderDetails['deliverto'] = Row['brname']
OrderHeaderDetails['ordertype'] = Row['tpe']
OrderHeaderDetails['printedpackingslip'] = 1
OrderHeaderDetails['fromstkloc'] = Config['Location']
OrderHeaderDetails['customerref'] = 'POS-' + Config['POS_ID'] + ' ' + str(Row['transno'])
OrderHeaderDetails['shipvia'] = Config['DefaultShipper']
try:
SalesOrder = x_server.weberp.xmlrpc_InsertSalesOrderHeader(OrderHeaderDetails,Config['webERPuser'],Config['webERPpwd'])
Then the sales order lines need to be added one at a time:
Code:
for OrderLine in OrderLines:
OrderLineDetails['stkcode'] = OrderLine['stockid']
OrderLineDetails['unitprice'] = OrderLine['price']
OrderLineDetails['quantity'] = OrderLine['qty']
OrderLineDetails['discountpercent'] = OrderLine['discountpercent']
OrderLineDetails['itemdue'] = OrderHeaderDetails['orddate']
OrderLineDetails['actualdispatchdate'] = OrderHeaderDetails['orddate']
OrderLineDetails['orderno'] = SalesOrder[1]
try:
SalesOrderLine = x_server.weberp.xmlrpc_InsertSalesOrderLine(OrderLineDetails,Config['webERPuser'],Config['webERPpwd'])
Then to invoice the order I wrote a new method that does all the inserts and updates necessary to complete as though the sale is a native webERP invoice - simply:
Code:
InvoiceArray = x_server.weberp.xmlrpc_InvoiceSalesOrder(SalesOrder[1],Config['webERPuser'],Config['webERPpwd'])
You then need to process the credit notes and receipts/payments too I guess. It is not a trivial exercise. The beauty of the API is you can do this from virtually any language which has XML-RPC functionality. I have done it from Vala/Genie, Python and PHP.
If you need a remote off-line sales system that integrates back to webERP then my Counter-Logic POS system would be ideal for you.