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

24 lines
913 B
Python

campus = env["education.campus"].search([], limit=1)
dept = env["education.department"].search([], limit=1)
prog = env["education.program"].search([], limit=1)
year = env["education.academic.year"].search([], limit=1)
user = env["res.users"].search([("login", "=", "demo.student")], limit=1)
if user and campus and dept and prog and year:
student = env["education.student"].create({
"full_name": "Demo Student",
"first_name": "Demo",
"last_name": "Student",
"email": "demo.student@example.com",
"portal_user_id": user.id,
"campus_id": campus.id,
"department_id": dept.id,
"program_id": prog.id,
"academic_year_id": year.id,
"date_of_birth": "2000-01-01",
"gender": "other",
"admission_number": "ADM-9999",
"student_id": "STU-9999"
})
env.cr.commit()
print("CREATED FULL STUDENT:", student.id)