[fix] create authentication entry while creating user

This commit is contained in:
Saurabh
2017-03-23 13:04:17 +05:30
parent 7b6be6c6b4
commit 7e63b93863

View File

@@ -18,17 +18,19 @@ def migrate():
last_name=u.last_name, last_name=u.last_name,
email=u.email email=u.email
)).insert(ignore_if_duplicate=True) )).insert(ignore_if_duplicate=True)
print u.name
print "sync auth" auth_details = source.sql('select * from __Auth where name = %s', u.email, as_dict=1)
auth = source.sql('select * from __Auth where name != "Administrator"', as_dict=1)
for user in auth: if auth_details:
if not frappe.db.sql("select doctype from __Auth where name = %s", user.name): auth = auth_details[0]
if not frappe.db.sql("select doctype from __Auth where name = %s", auth.name):
frappe.db.sql("""insert into __Auth frappe.db.sql("""insert into __Auth
(doctype, name, fieldname, password, salt, encrypted) (doctype, name, fieldname, password, salt, encrypted)
values (%s, %s, %s, %s, %s, %s)""", values (%s, %s, %s, %s, %s, %s)""",
(user.doctype, user.name, user.fieldname, user.password, user.salt, user.encrypted)) (auth.doctype, auth.name, auth.fieldname, auth.password, auth.salt, auth.encrypted))
print user.name
print u.name
frappe.db.sql('delete from `tabService Provider`') frappe.db.sql('delete from `tabService Provider`')
partners = source.sql('select * from `tabFrappe Partner`', as_dict=True) partners = source.sql('select * from `tabFrappe Partner`', as_dict=True)