summaryrefslogtreecommitdiff
path: root/openerpcommand
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2013-01-21 16:41:07 +0100
committerVo Minh Thu <vmt@openerp.com>2013-01-21 16:41:07 +0100
commit9d56c47916678ef163fc4ffde095988862ec02f0 (patch)
treee65daccbb8e17b88efaab9b35db9d4f592c528f6 /openerpcommand
parent8a279675254b4a157a41512b5418cda149d40079 (diff)
[IMP] oe read: use the environment if --addons is not provided.
bzr revid: vmt@openerp.com-20130121154107-uwa6pfowzks106xp
Diffstat (limited to 'openerpcommand')
-rw-r--r--openerpcommand/read.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/openerpcommand/read.py b/openerpcommand/read.py
index 83d6a5340f8..b013f14fecd 100644
--- a/openerpcommand/read.py
+++ b/openerpcommand/read.py
@@ -5,6 +5,8 @@ import os
import sys
import textwrap
+import common
+
# TODO provide a --rpc flag to use XML-RPC (with a specific username) instead
# of server-side library.
def run(args):
@@ -13,6 +15,11 @@ def run(args):
import openerp
config = openerp.tools.config
config['log_handler'] = [':CRITICAL']
+ if args.addons:
+ args.addons = args.addons.split(':')
+ else:
+ args.addons = []
+ config['addons_path'] = ','.join(args.addons)
openerp.netsvc.init_logger()
registry = openerp.modules.registry.RegistryManager.get(
args.database, update_module=False)
@@ -44,8 +51,9 @@ def run(args):
def add_parser(subparsers):
parser = subparsers.add_parser('read',
description='Display a record.')
- parser.add_argument('-d', '--database', metavar='DATABASE', required=True,
- help='the database to connect to')
+ parser.add_argument('-d', '--database', metavar='DATABASE',
+ **common.required_or_default('DATABASE', 'the database to connect to'))
+ common.add_addons_argument(parser)
parser.add_argument('-m', '--model', metavar='MODEL', required=True,
help='the model for which a record should be read')
parser.add_argument('-i', '--id', metavar='RECORDID', required=True,