# -*- coding: utf-8 -*-

import odoorpc


def parser(parser):
    """ Helper that takes an arg parser, add common options and return it """
    parser.add_argument('-oh', '--host', type=str, default='odoo',
                        help='the odoo host')
    parser.add_argument('-op', '--port', type=int, default=8069,
                        help='the odoo port')
    return parser


def connection(args):
    """ Helper that takes args and return an odoo connection """
    odoo = odoorpc.ODOO(args.host, port=args.port)
    odoo.config['timeout'] = 600
    return odoo
