示例#1
0
This script check all model in the module
and launch a search, read, field_view_get, etc...
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser
from optparse import OptionGroup
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:
示例#2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser
from optparse import OptionGroup
from lxml.etree import Element, SubElement
from lxml.etree import tostring
import uuid
import os

import logging
import sys

parser = GetParser('Export scenario', '0.1')
group = OptionGroup(parser, "Object arguments", "Application Options")
group.add_option('-v',
                 '--verbose',
                 dest='verbose',
                 action='store_true',
                 default=False,
                 help='Add verbose mode')
group.add_option('',
                 '--header',
                 dest='header',
                 action='store_true',
                 default=False,
                 help='Add XML and OpenObkect Header')
group.add_option('',
                 '--indent',
##############################################################################

"""
This script enable a connection on the OpenERP Server and return the list of
module whom are installed.
"""

import sys

sys.path.append("../")

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser

parser = GetParser("Module List", "0.1")
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)

modules = Object(cnx, "ir.module.module")
print "--[Connection Object]---------------------"
print "%s" % str(modules)

ids = modules.search([("state", "=", "installed")])
print "--[Module list]---------------------------"
for p in modules.read(ids, ["name"]):
示例#4
0
"""

import sys

sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser
from optparse import OptionGroup
import os
import glob
import logging
import csv

parser = GetParser('Import 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 import, you can use wildard as 100-product.product_*.csv'
)
group.add_option('',
                 '--directory',
                 dest='directory',
                 default=False,
                 help='Indicate teh directory to scan file')
group.add_option('',
#
##############################################################################

"""
Extract XML for selected object or the globality
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Workflow
from oobjlib.common import GetParser
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()
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
"""
This script enable a connection on the OpenERP Server and a product 
This test use the demo database
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser

parser = GetParser('Create Product', '0.1')
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)

product = Object(cnx, 'product.product')

args = {
示例#7
0
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

"""
Connect to the server and return the list of databases
"""

import sys
sys.path.append('../')

from oobjlib.connection import Database
from oobjlib.common import GetParser

parser = GetParser('Database List', '0.1')
opts, args = parser.parse_args()

try:
    db = Database(
        server=opts.server,
        port=opts.port,
        supadminpass=opts.admin)
except Exception, e:
    print '%s' % str(e)
    exit(1)

print '--[Server Connection]-i---------------------'
print '%s' % str(db)

print '--[Database list]---------------------------'
Export data to OpenOffice Sheet
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser
from optparse import OptionGroup
import os
import logging

__version__ = (0, 1)

parser = GetParser('Export data to OpenOffice Sheet', '.'.join(map(str, __version__)))
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('-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('-m', '--model', dest='model',
                default=False,
                help='Enter the model name to export')
示例#9
0
"""
This script enable a connection to the openerp server and
And stay in interractive mode (use python -i to do this)
"""

import sys
import code

sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object, Wizard, Workflow, Report
from oobjlib.common import GetParser
from optparse import OptionGroup

parser = GetParser('Interractive mode', '0.1')

group = OptionGroup(parser, "Object arguments", "Application Options")
group.add_option('-m',
                 '--model',
                 dest='model',
                 default='',
                 help='Enter the model name in OpenObject')
parser.add_option_group(group)

try:
    opts, args = parser.parse_args()
except SystemExit:
    sys.exit(0)

try:
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
"""
This script enable a connection on the OpenERP Server and return the list of
module whom are installed.
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser

parser = GetParser('Module List', '0.1')
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)

modules = Object(cnx, "ir.module.module")
print '--[Connection Object]---------------------'
print '%s' % str(modules)
示例#11
0
"""
This program check if parent_store on object is correct, if not
you must correct it
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser
from optparse import OptionGroup

import logging

parser = GetParser('Check parent store', '0.1')
group = OptionGroup(parser, "Object arguments", "Application Options")
group.add_option('-m',
                 '--model',
                 dest='model',
                 default=False,
                 help='Enter the name of the file to import')
group.add_option('-f',
                 '--field',
                 dest='field',
                 default='parent_id',
                 help='Indicate the parent field (default parent_id)')
group.add_option('-v',
                 '--verbose',
                 dest='verbose',
                 action='store_true',
示例#12
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
"""
Extract XML for selected object or the globality
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Workflow
from oobjlib.common import GetParser
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',
"""
This script check all model in the module
and launch a search, read, field_view_get, etc...
"""

import sys
sys.path.append('../')

from oobjlib.connection import Connection
from oobjlib.component import Object
from oobjlib.common import GetParser
from optparse import OptionGroup


parser = GetParser('Regression model', '0.1')
group = OptionGroup(parser, 'Display information',
                "Others arguments")
group.add_option('--all-views', dest='all_views',
                action='store_true',
                default=False,
                help='Test all views, not only the default view'),
group.add_option('-q', '--quiet', dest='quiet',
                action='store_true',
                default=False,
                help='Reduce output only with error'),
group.add_option('-o', '--openerp-version', dest='oerp_version',
                default=6,
                help='Indicate the version of OpenERP (5 or 6)')
parser.add_option_group(group)
opts, args = parser.parse_args()