summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@openerp.com>2013-08-01 17:53:34 +0200
committerDenis Ledoux <dle@openerp.com>2013-08-01 17:53:34 +0200
commit93ffa6dbcbb185ce27bd8b0d1c8ba793af5be642 (patch)
treeef359dedb5e0f217fd02c15e487c3ab02e43d7d7
parent957fa4e2dab422ce6aebf7b86b2d054ab93ca083 (diff)
parentf551350b8093816ed7ec456d786bb231ffec0460 (diff)
[MERGE] Forward-port of 7.0 bugfixes up to rev. 9339 (dle@openerp.com-20130801151539-z0bes7ylx5qwa8tw)
bzr revid: dle@openerp.com-20130801142357-09zojxyhaop9fwna bzr revid: dle@openerp.com-20130801155334-hq3dzmheppde3xqp
-rw-r--r--addons/auth_crypt/auth_crypt.py19
-rw-r--r--addons/stock/wizard/stock_change_product_qty.py2
2 files changed, 11 insertions, 10 deletions
diff --git a/addons/auth_crypt/auth_crypt.py b/addons/auth_crypt/auth_crypt.py
index d0a4fda9632..08dd156a603 100644
--- a/addons/auth_crypt/auth_crypt.py
+++ b/addons/auth_crypt/auth_crypt.py
@@ -143,7 +143,7 @@ class res_users(osv.osv):
cr.execute('SELECT password, password_crypt FROM res_users WHERE id=%s AND active', (uid,))
if cr.rowcount:
stored_password, stored_password_crypt = cr.fetchone()
- if password and not stored_password_crypt:
+ if stored_password and not stored_password_crypt:
salt = gen_salt()
stored_password_crypt = md5crypt(stored_password, salt)
cr.execute("UPDATE res_users SET password='', password_crypt=%s WHERE id=%s", (stored_password_crypt, uid))
@@ -151,14 +151,15 @@ class res_users(osv.osv):
return super(res_users, self).check_credentials(cr, uid, password)
except openerp.exceptions.AccessDenied:
# check md5crypt
- if stored_password_crypt[:len(magic_md5)] == magic_md5:
- salt = stored_password_crypt[len(magic_md5):11]
- if stored_password_crypt == md5crypt(password, salt):
- return
- elif stored_password_crypt[:len(magic_md5)] == magic_sha256:
- salt = stored_password_crypt[len(magic_md5):11]
- if stored_password_crypt == md5crypt(password, salt):
- return
+ if stored_password_crypt:
+ if stored_password_crypt[:len(magic_md5)] == magic_md5:
+ salt = stored_password_crypt[len(magic_md5):11]
+ if stored_password_crypt == md5crypt(password, salt):
+ return
+ elif stored_password_crypt[:len(magic_md5)] == magic_sha256:
+ salt = stored_password_crypt[len(magic_md5):11]
+ if stored_password_crypt == md5crypt(password, salt):
+ return
# Reraise password incorrect
raise
diff --git a/addons/stock/wizard/stock_change_product_qty.py b/addons/stock/wizard/stock_change_product_qty.py
index a5f700b442d..01ed6f2409a 100644
--- a/addons/stock/wizard/stock_change_product_qty.py
+++ b/addons/stock/wizard/stock_change_product_qty.py
@@ -67,7 +67,7 @@ class stock_change_product_qty(osv.osv_memory):
self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
except (orm.except_orm, ValueError):
location_id = False
- res.update({'location_id': location_id and location_id.id or False})
+ res.update({'location_id': location_id})
return res
def change_product_qty(self, cr, uid, ids, context=None):