Beispiel #1
0
def before_all(ctx):
    if erppeek.__version__ < '1.6':
        server = erppeek.start_openerp_services(' '.join(OPENERP_ARGS))
    else:
        server = erppeek.start_odoo_services(OPENERP_ARGS)
    database = server.tools.config['db_name']

    def _output_write(text):
        for stream in ctx.config.outputs:
            stream.open().write(text)

    ctx._output_write = _output_write
    ctx._is_context = True
    ctx.client = erppeek.Client(server, verbose=ctx.config.verbose)
    ctx.conf = {
        'server':
        server,
        'admin_passwd':
        server.tools.config['admin_passwd'],
        'admin_login_password':
        server.tools.config.get('admin_login_password', 'admin'),
        'db_name':
        database,
        'openerp_config':
        server.tools.config,
    }
Beispiel #2
0
def before_all(ctx):
    conf = None
    server = None
    openerp_args = OPENERP_ARGS
    if hasattr(ctx.config, 'server_config') and ctx.config.server_config:
        conf = parse_openerp_config(ctx.config.server_config)
        server = conf['server']
    elif OPENERP_IN_PATH:
        if hasattr(ctx.config, 'server_args') and ctx.config.server_args:
            openerp_args = ctx.config.server_args.split('|')
        if erppeek.__version__ < '1.6':
            server = erppeek.start_openerp_services(' '.join(openerp_args))
        else:
            server = erppeek.start_odoo_services(openerp_args)
        database = server.tools.config['db_name']
        conf = {'server': server,
                'admin_passwd': server.tools.config['admin_passwd'] or 'admin',
                }
        conf.update(server.tools.config.options)
    else:
        raise ValueError(
            'No Odoo/OpenERP configuration file passed '
            'while odoo or openerp is not available in sys path. '
            'Please provide a value for the --server-config option'
        )

    def _output_write(text):
        for stream in ctx.config.outputs:
            stream.open().write(text)

    assert (conf and server)
    ctx._output_write = _output_write
    ctx._is_context = True
    ctx.client = erppeek.Client(server, verbose=ctx.config.verbose)
    ctx.conf = conf
Beispiel #3
0
def before_all(ctx):
    conf = None
    server = None
    openerp_args = OPENERP_ARGS
    if hasattr(ctx.config, 'server_config') and ctx.config.server_config:
        conf = parse_openerp_config(ctx.config.server_config)
        server = conf['server']
    elif OPENERP_IN_PATH:
        if hasattr(ctx.config, 'server_args') and ctx.config.server_args:
            openerp_args = ctx.config.server_args.split('|')
        if erppeek.__version__ < '1.6':
            server = erppeek.start_openerp_services(' '.join(openerp_args))
        else:
            server = erppeek.start_odoo_services(openerp_args)
        database = server.tools.config['db_name']
        conf = {
            'server': server,
            'admin_passwd': server.tools.config['admin_passwd'] or 'admin',
        }
        conf.update(server.tools.config.options)
    else:
        raise ValueError(
            'No Odoo/OpenERP configuration file passed '
            'while odoo or openerp is not available in sys path. '
            'Please provide a value for the --server-config option')

    def _output_write(text):
        for stream in ctx.config.outputs:
            stream.open().write(text)

    assert (conf and server)
    ctx._output_write = _output_write
    ctx._is_context = True
    ctx.client = erppeek.Client(server, verbose=ctx.config.verbose)
    ctx.conf = conf
Beispiel #4
0
def before_all(ctx):
    if erppeek.__version__ < '1.6b1':
        server = erppeek.start_openerp_services(' '.join(OPENERP_ARGS))
    else:
        server = erppeek.start_odoo_services(OPENERP_ARGS)
    database = server.tools.config['db_name']
    def _output_write(text):
        for stream in ctx.config.outputs:
            stream.open().write(text)
    ctx._output_write = _output_write
    ctx._is_context = True
    ctx.client = erppeek.Client(server, verbose=ctx.config.verbose)
    ctx.conf = {'server': server,
                'admin_passwd': server.tools.config['admin_passwd'],
                'db_name': database,
                'openerp_config': server.tools.config,
                }