From 89bb1948ceabe119da5d6104b979e03c074a4ae0 Mon Sep 17 00:00:00 2001 From: Fabien Bourgeois Date: Wed, 11 Jan 2017 10:05:53 +0100 Subject: [PATCH] [IMP]Docker / Odoo databses management with duplicate name and optional admin pass for database --- odoo/scripts/databases.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/odoo/scripts/databases.py b/odoo/scripts/databases.py index 5a4adc3..bc71c1e 100644 --- a/odoo/scripts/databases.py +++ b/odoo/scripts/databases.py @@ -15,18 +15,20 @@ def main(): parser = common.parser(parser) parser.add_argument('-a', '--action', type=str, default='create', help='action for the database,' + - 'default to create') + 'default to create (others are drop, duplicate)') parser.add_argument('-d', '--database', type=str, required=True, help='the targetted database') + parser.add_argument('-dn', '--duplicate-name', type=str, + help=('name for duplicated database (optional : ' + 'name_copy otherwise')) parser.add_argument('-pw', '--password', type=str, required=True, help='the odoo superadmin password') parser.add_argument('-dm', '--demo', type=str, default='False', help='demonstration data') parser.add_argument('-l', '--lang', type=str, default='fr_FR', help='default language') - parser.add_argument('-dbpw', '--database_password', type=str, - required=True, - help='the database admin password') + parser.add_argument('-dbpw', '--database_password', type=str, default='admin', + help='the database admin password, default to admin') args = parser.parse_args() # Connection @@ -46,8 +48,8 @@ def main(): elif args.action == 'drop': odoo.db.drop(args.password, args.database) elif args.action == 'duplicate': - odoo.db.duplicate(args.password, args.database, args.database + - '_copy') + name = args.duplicate_name or args.database + '_copy' + odoo.db.duplicate(args.password, args.database, name) if __name__ == "__main__": main()