Metatron_Student_ERP/setup_demo_student.py
2026-10-01 11:16:50 +05:30

16 lines
500 B
Python

user = env["res.users"].search([("login", "=", "demo.student")], limit=1)
if user:
student = env["education.student"].search([], limit=1)
if student:
student.write({"portal_user_id": user.id})
env.cr.commit()
print("LINKED STUDENT ID:", student.id, "TO USER ID:", user.id)
else:
print("NO STUDENT FOUND")
else:
print("NO USER FOUND")
print("USER:", user.id)
print("USER STUDENT:", user.student_id.id)
print("STUDENT NAME:", user.student_id.full_name)