Example #1
0
logging.basicConfig(level=logging.DEBUG)

rpc.openSession(proto="http",
                host='localhost',
                port='8169',
                user="******",
                passwd="admin",
                superpass="******",
                dbname="test_bqi")

# Get a new proxy, for super-admin authentication
root_proxy = rpc.RpcCustomProxy('/common', auth_level='root')
ost1 = root_proxy.get_os_time()
print "OS times:", ost1

rpc.login()
stock_loc_obj = rpc.RpcProxy('stock.location')

for i in range(100):
    #loc_ids = stock_loc_obj.search([])
    #locations = stock_loc_obj.read(loc_ids)
    locations = stock_loc_obj.search_read([])
    if i < 2:
        for sl in locations:
            print "loc: %(name)s \treal: %(stock_real)s Virtual: %(stock_virtual)s" % sl
    else:
        print "again:", i, len(locations)

ost2 = root_proxy.get_os_time()

print "Os times: ", ost2[0] - ost1[0], ost2[1] - ost1[1], ost2[2] - ost1[2]
import logging

from openerp_libclient import rpc

logging.basicConfig(level=logging.DEBUG)

rpc.openSession(proto="http", host='localhost', port='8169', 
    user="******", passwd="admin", superpass="******", dbname="test_bqi")

# Get a new proxy, for super-admin authentication
root_proxy = rpc.RpcCustomProxy('/common', auth_level='root')
ost1 = root_proxy.get_os_time()
print "OS times:", ost1

rpc.login()
stock_loc_obj = rpc.RpcProxy('stock.location')

for i in range(100):
    #loc_ids = stock_loc_obj.search([])
    #locations = stock_loc_obj.read(loc_ids)
    locations = stock_loc_obj.search_read([])
    if i < 2:
        for sl in locations:
            print "loc: %(name)s \treal: %(stock_real)s Virtual: %(stock_virtual)s" % sl
    else:
        print "again:", i, len(locations)
 
ost2 = root_proxy.get_os_time()

print "Os times: ", ost2[0] - ost1[0], ost2[1] - ost1[1], ost2[2] - ost1[2]
Example #3
0
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from openerp_libclient import rpc
from openerp_libclient.extra import options
import logging

print "Will initialize all options and logging"
options.init() # just the plain defaults, no config file

log = logging.getLogger('main')
log.info("Init. Connecting...")

rpc.openSession(**options.connect_dsn)

if not rpc.login():
    raise Exception("Could not login!")
log.info("Connected.")

# -----8<---- cut here ----8<----
# Now, perform a trivial request
request_obj = rpc.RpcProxy('res.request')
req_to, req_from = request_obj.request_get() # custom function

log.info("Have %d pending requests (sent %d ones)", len(req_to), len(req_from))

if req_to:
    res = request_obj.read(req_to[0], ['name', 'act_from', 'date_sent', 'state'])
    if res:
        print
        print "From: %s" % res['act_from'][1]
        print "Date: %s" % res['date_sent']
Example #4
0
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import sys
import os

import logging

from openerp_libclient import rpc

logging.basicConfig(level=logging.DEBUG)

rpc.openSession(proto="http", host='localhost', port='8069', 
    user="******", passwd="admin", dbname="refdb")
r = rpc.login()
if not r :
    raise Exception("Could not login! %r" % r)


ira_obj = rpc.RpcProxy('ir.attachment')
ira_obj.search_read([], fields=['index_content'])


#eof
Example #5
0
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from openerp_libclient import rpc
from openerp_libclient.extra import options
import logging

print "Will initialize all options and logging"
options.init()  # just the plain defaults, no config file

log = logging.getLogger('main')
log.info("Init. Connecting...")

rpc.openSession(**options.connect_dsn)

if not rpc.login():
    raise Exception("Could not login!")
log.info("Connected.")

# -----8<---- cut here ----8<----
# Now, perform a trivial request
request_obj = rpc.RpcProxy('res.request')
req_to, req_from = request_obj.request_get()  # custom function

log.info("Have %d pending requests (sent %d ones)", len(req_to), len(req_from))

if req_to:
    res = request_obj.read(req_to[0],
                           ['name', 'act_from', 'date_sent', 'state'])
    if res:
        print
        print "From: %s" % res['act_from'][1]