From a1f0529a25bc7d608278b769ebd749fb4e781b87 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Tue, 2 Jan 2018 10:07:03 +0100 Subject: [PATCH] [IMP]Odoo database script : allow full path when needed --- odoo/scripts/databases.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/odoo/scripts/databases.py b/odoo/scripts/databases.py index 8fa837d..c62e351 100644 --- a/odoo/scripts/databases.py +++ b/odoo/scripts/databases.py @@ -20,7 +20,10 @@ def dump(odoo, args): def restore(odoo, args): """ Restores database from local file to local or remote host """ - dump_path = u'{}/{}_{}.zip'.format(args.dump_path, args.host, args.database) + if args.dump_full_path: + dump_path = args.dump_full_path + else: + dump_path = u'{}/{}_{}.zip'.format(args.dump_path, args.host, args.database) with open(dump_path, 'rb') as dump_file: if args.target_host and args.target_port and args.target_password: connection = odoorpc.ODOO(args.target_host, port=args.target_port) @@ -53,6 +56,9 @@ def main(): parser.add_argument('-dp', '--dump-path', type=str, default='/tmp/', help='the absolute path where to dump the database, ' 'defaults to /tmp/') + parser.add_argument('-dfp', '--dump-full-path', type=str, + help='the absolute full path where to dump the database, ' + 'used if given, else dump path is used') parser.add_argument('-dt', '--database-target', type=str, help=('name for duplicated or restore targetted database ' ' (optional : name_copy otherwise'))