Android interface to OpenERP using QPython

  QPython  is Python for Android.

QPython - a script Engine running on Android devices like phone or tablet, It integrates the Python Programming and QRCode read & write technology, which help driving your android device to work as you want more quickly and more effectively.  The authors have done a good job and is worth testing. I managed to get a connection to OpenERP using the following QR code script. Test it on your own database. 

Create a new OpenERP database with the following characteristics:
  • database name: demo
  • admin user: admin
  • password: admin
  • Install the following modules:
  • sales, warehouse, manufacturing (with demo data)
As you can't really enter code into a mobile phone that easier, the authors provide an interesting QR code upload feature which works suprisingly well for short programs. 


The following demo will enable you to query your OpenERP server from an Android device.  It will search all Bill of Materials (BoM) on in your database and display and an on screen  report of all BoM's structures with respective components. The layout is a bit rough, but it's just a PoC. 

Install the QPython App from the Google Play Store. Load the following program using the option Get script from  QRCode. The camera will turn as a QR-Code scanner. Just scan the following program which as been encoded as a QRcode:

After acceptance of the QRCode you 'll see it displayed in a Python-Idle style editor.  The only line you'll need to edit is the IP address of your server. 

sock = xmlrpclib.ServerProxy('http://your IP address here:8069/xmlrpc/object')

Ensure to keep the http:// in the front of the IP address - otherwise you'll get an error message stating that he library doesn't support the protocol.  

Run the application. If all went well you'll receive a new messages in your normal 'messages' application with the results of the query displayed (also if there is an error). It's a pity the authors didn't include a pop-up to display the results. Nethertheless it works as a PoC.   

Android QPyhton Interface to OpenERP

import xmlrpclib
sock = xmlrpclib.ServerProxy('http://your IP address here:8069/xmlrpc/object')
uid = 1
pwd = 'admin'  
dbname ='demo'
args = [('bom_lines', '!=', '')] #query clause
ids = sock.execute(dbname, uid, pwd, '', 'search', args)
print 'The following BOM Records have a BOM ID of = ',ids 
bom_fields = ('name', 'product_id','bom_lines' )
for i in range(len(ids)):   
    bom_id1 = sock.execute(dbname, uid, pwd, (''), 'read', ids[i], bom_fields) 
    print '----------------------------------'
    print 'Main BOM=', ids[i], bom_id1, bom_id1['bom_lines']  
    for child1 in bom_id1['bom_lines']:
        bom_child1 = sock.execute(dbname, uid, pwd, (''), 'read', child1, bom_fields)   
        anewlist = bom_child1 ['product_id']
        print '*******Child1 =',child1, ',',bom_child1 ['name'], ',', anewlist [0] , ',',   bom_child1 ['bom_lines']