From d4624fa826a5e9542782f2c53c8ba2c766d093bc Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 29 May 2014 18:33:04 +0200 Subject: [IMP] repository cleanup - move packaging stuff to setup - remove historical stuff - remove oe, odoo-cmd-fme will be merged with the convered commands - add an odoo.py script to run odo and boostrap it - simplify README - prepare to move documentation to the github wiki --- openerpcommand/model.py | 61 ------------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 openerpcommand/model.py (limited to 'openerpcommand/model.py') diff --git a/openerpcommand/model.py b/openerpcommand/model.py deleted file mode 100644 index ccd3ae78718..00000000000 --- a/openerpcommand/model.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Display information about a given model. -""" -import os -import sys -import textwrap - -def run(args): - assert args.database - assert args.model - import openerp - openerp.tools.config['log_level'] = 100 - openerp.netsvc.init_logger() - registry = openerp.modules.registry.RegistryManager.get( - args.database, update_module=False) - model = registry[args.model] - longest_k = 1 - longest_string = 1 - columns = model._columns - - if args.field and args.field not in columns: - print "No such field." - sys.exit(1) - - if args.field: - columns = { args.field: columns[args.field] } - else: - print "Fields (model `%s`, database `%s`):" % (args.model, args.database) - - for k, v in columns.items(): - longest_k = len(k) if longest_k < len(k) else longest_k - longest_string = len(v.string) \ - if longest_string < len(v.string) else longest_string - for k, v in sorted(columns.items()): - attr = [] - if v.required: - attr.append("Required") - if v.readonly: - attr.append("Read-only") - attr = '/'.join(attr) - attr = '(' + attr + ')' if attr else attr - if args.verbose: - print v.string, '-- ' + k + ', ' + v._type, attr - else: - print k.ljust(longest_k + 2), v._type, attr - if args.verbose and v.help: - print textwrap.fill(v.help, initial_indent=' ', subsequent_indent=' ') - -def add_parser(subparsers): - parser = subparsers.add_parser('model', - description='Display information about a given model for an existing database.') - parser.add_argument('-d', '--database', metavar='DATABASE', required=True, - help='the database to connect to') - parser.add_argument('-m', '--model', metavar='MODEL', required=True, - help='the model for which information should be displayed') - parser.add_argument('-v', '--verbose', action='store_true', - help='display more information') - parser.add_argument('-f', '--field', metavar='FIELD', - help='display information only for this particular field') - - parser.set_defaults(run=run) -- cgit v1.2.3