Esempio n. 1
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='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([])
Esempio n. 2
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='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)
Esempio n. 3
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",
                superpass="******",
                dbname="refdb")

pub_proxy = rpc.RpcCustomProxy('/common')
print "About this Server:"
print pub_proxy.about()
print

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

#eof
Esempio n. 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
Esempio n. 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]
        print "Date: %s" % res['date_sent']
Esempio n. 6
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]
Esempio n. 7
0
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from openerp_libclient import rpc
import threading

db_props = {}
db_props['proto'] = 'http'
db_props['dbname'] = 'test_bqi'
db_props['host'] = 'localhost'
db_props['port'] = 8169
db_props['user'] = '******'
db_props['passwd'] = 'admin'

rpc.openSession(**db_props)

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

slow_obj = rpc.RpcProxy('test_orm.slow1')

def fun(slow_obj, name):
    res = slow_obj.do_slow([], context={})
    print "Finished %s" % name

num_calls = 70
print "Launching %d slow RPC calls:" % num_calls
thrs = []
for n in range(num_calls):
    # one call in sync, to test
    try:
        res = slow_obj.exists([1])
Esempio n. 8
0
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from openerp_libclient import rpc
import threading

db_props = {}
db_props['proto'] = 'http'
db_props['dbname'] = 'test_bqi'
db_props['host'] = 'localhost'
db_props['port'] = 8169
db_props['user'] = '******'
db_props['passwd'] = 'admin'

rpc.openSession(**db_props)

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

slow_obj = rpc.RpcProxy('test_orm.slow1')


def fun(slow_obj, name):
    res = slow_obj.do_slow([], context={})
    print "Finished %s" % name


num_calls = 70
print "Launching %d slow RPC calls:" % num_calls
thrs = []
for n in range(num_calls):
    # one call in sync, to test