コード例 #1
0
                 dest='indent',
                 action='store_true',
                 default=False,
                 help='Indent the XML output')
group.add_option('',
                 '--id',
                 dest='scenario_id',
                 default=False,
                 help='id of the scenario to extract')
group.add_option(
    '',
    '--directory',
    dest='directory',
    default='.',
    help='directory where the script will write the scenario files')
parser.add_option_group(group)
opts, args = parser.parse_args()

logger = logging.getLogger("check_parent_store")
ch = logging.StreamHandler()
if opts.verbose:
    logger.setLevel(logging.DEBUG)
    ch.setLevel(logging.DEBUG)
else:
    logger.setLevel(logging.INFO)
    ch.setLevel(logging.INFO)

formatter = logging.Formatter(
    "%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)
コード例 #2
0
from optparse import OptionGroup

parser = GetParser('Workflow manager', '0.1')

common = OptionGroup(parser, "Application",
        "Application option")
common.add_option('-m','--model', dest='model',
                 default='res.partner',
                 help='select the model (eg: account.invoice)')
common.add_option('', '--signal', dest='signal',
                 default='',
                 help='Enter the signal in the workflow to call (eg: invoice_open)')
common.add_option('', '--id', dest='id',
                 default=0,
                 help='Enter the id of record')
parser.add_option_group(common)

opts, args = parser.parse_args()

try:
    cnx = Connection(
        server=opts.server, 
        dbname=opts.dbname, 
        login=opts.user, 
        password=opts.passwd, 
        port=opts.port)
except Exception, e:
    print '%s' % str(e)
    exit(1)

acc = Workflow(cnx, opts.model)
コード例 #3
0
import os
import logging
import csv

parser = GetParser('Export CSV compatible with OpenERP', '0.2')
group = OptionGroup(parser, "Object arguments", "Application Options")
group.add_option('-f', '--file', dest='filename', default=False, help='Enter the name of the file to export')
group.add_option('-m', '--model', dest='model', default=False, help='Enter the name of the model to export')
group.add_option('', '--ids', dest='ids', default=False, help='Enter the ids to export')
group.add_option('', '--fields', dest='fields', default=False, help='Enter the name of the fields to export')
group.add_option('', '--separator', dest='separator', default=',', help='Enter the comma separator, default ","')
group.add_option('-v', '--verbose', dest='verbose', action='store_true', default=False, help='Add verbose mode')
group.add_option('-l', '--log-file', dest='logfile', default=False, help='Enter the name of the log file')
group.add_option('', '--language', dest='lang', default='en_US', help='Specify the language to search on translate field, default en_US')
group.add_option('', '--with-inactive', dest='inactive', action='store_true', default=False, help='Extract inactive records')
parser.add_option_group(group)

opts, args = parser.parse_args()

if opts.logfile:
    ch = logging.FileHandler(opts.logfile)
else:
    ch = logging.StreamHandler()

logger = logging.getLogger("exportcsv")
if opts.verbose:
    logger.setLevel(logging.DEBUG)
    ch.setLevel(logging.DEBUG)
else:
    logger.setLevel(logging.INFO)
    ch.setLevel(logging.INFO)
コード例 #4
0
                  '--model',
                  dest='model',
                  default='res.partner',
                  help='select the model (eg: account.invoice)')
common.add_option(
    '',
    '--signal',
    dest='signal',
    default='',
    help='Enter the signal in the workflow to call (eg: invoice_open)')
common.add_option('',
                  '--id',
                  dest='id',
                  default=0,
                  help='Enter the id of record')
parser.add_option_group(common)

opts, args = parser.parse_args()

try:
    cnx = Connection(server=opts.server,
                     dbname=opts.dbname,
                     login=opts.user,
                     password=opts.passwd,
                     port=opts.port)
except Exception, e:
    print '%s' % str(e)
    exit(1)

acc = Workflow(cnx, opts.model)