# HG changeset patch
# User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr>
# Date 1632842537 -7200
#      Tue Sep 28 17:22:17 2021 +0200
# Node ID 0835ec042fb7e94d04a027699dbf29971f974aba
# Parent  662eae0c6924b0d7857146f388f1b52c4bee14c3
✨ use getpass to read password when not provided

diff --git a/NEWS.rst b/NEWS.rst
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -7,6 +7,8 @@
 
 Fix reading other sources from setup, it was only accepting directories.
 
+Password in imports and odoo scripts is not mandatory anymore, if not provided, it will be asked by using getpass.
+
 11.0.0
 ------
 
diff --git a/odoo_scripts/odoo.py b/odoo_scripts/odoo.py
--- a/odoo_scripts/odoo.py
+++ b/odoo_scripts/odoo.py
@@ -1,6 +1,7 @@
 """Function to ease connection to an Odoo server
 """
 import argparse
+import getpass
 import logging
 from typing import Optional
 
@@ -29,6 +30,8 @@
     )
     o = odoorpc.ODOO(host, port=port, protocol=protocol, timeout=timeout)
     _logger.info("Connected")
+    if password is None:
+        password = getpass.getpass("{} Password:".format(login))
     # Do "o.login(ODOO_DB, 'admin', ODOO_ADMIN_PASS)" by hand here so we can
     # grab the session ID (odoorpc does not store it anywhere).
     data = o.json(
@@ -54,7 +57,7 @@
     parser.add_argument(
         "--login", help="Odoo user [default: %(default)s]", default="admin"
     )
-    parser.add_argument("--password", help="Odoo user password", required=True)
+    parser.add_argument("--password", help="Odoo user password")
     parser.add_argument(
         "-p", "--port", help="Odoo port [default: %(default)s]", default=8069
     )