[FIX] account_voucher: fixed error in yaml test
[odoo/odoo.git] / addons / document_ftp / test_easyftp.py
index 419a346..74890b1 100644 (file)
@@ -36,8 +36,13 @@ def get_plain_ftp(timeout=10.0):
 
 def get_ftp_login(cr, uid, ormobj):
     ftp = get_plain_ftp()
-    user = ormobj.pool.get('res.users').read(cr, uid, uid)
-    ftp.login(user.get('login',''), user.get('password',''))
+    user = ormobj.pool.get('res.users').browse(cr, uid, uid)
+    passwd = user.password or ''
+    if passwd.startswith("$1$"):
+        # md5 by base crypt. We cannot decode, wild guess
+        # that passwd = login
+        passwd = user.login
+    ftp.login(user.login, passwd)
     ftp.cwd("/" + cr.dbname)
     return ftp