mirror of
https://github.com/hanzo-io/team.git
synced 2026-10-30 18:56:23 +00:00
22 lines
801 B
Python
22 lines
801 B
Python
import frappe
|
|
|
|
|
|
def execute():
|
|
"""Creating Raven Users for existing users with the "Raven User" role."""
|
|
|
|
# In Raven v1.2, we introduced the "Raven User" doctype.
|
|
# Reference: [#427](https://github.com/The-Commit-Company/Raven/issues/427)
|
|
# This doctype is used to store the user's profile picture and full name.
|
|
# However, existing users with the "Raven User" role will not have a corresponding Raven User record.
|
|
# This patch creates Raven Users for all users with the "Raven User" role.
|
|
users = frappe.get_all(
|
|
"User",
|
|
filters=[["name", "not in", ["Guest"]], ["Has Role", "role", "=", "Raven User"]],
|
|
)
|
|
|
|
for user in users:
|
|
if not frappe.db.exists("Raven User", {"user": user.name}):
|
|
raven_user = frappe.new_doc("Raven User")
|
|
raven_user.user = user.name
|
|
raven_user.insert()
|