Full backend implementation with custom Odoo modules: - encoach_api: Core API, user management, JWT auth - encoach_exam: Exam generation (reading, writing, listening, speaking) - encoach_evaluate: AI-powered evaluation (writing, speaking) - encoach_training: Training tips and walkthrough - encoach_storage: File storage management - encoach_payment: Stripe, PayPal, Paymob integration - encoach_mail: Email notifications Made-with: Cursor
22 lines
660 B
Python
22 lines
660 B
Python
from odoo import models, fields
|
|
|
|
|
|
class EncoachSession(models.Model):
|
|
_name = "encoach.session"
|
|
_description = "EnCoach Exam Session"
|
|
_order = "date desc"
|
|
|
|
user_id = fields.Many2one("res.users", required=True, index=True)
|
|
exam_data = fields.Json(help="Full exam state snapshot (ExamState)")
|
|
date = fields.Datetime(default=fields.Datetime.now)
|
|
legacy_id = fields.Char(index=True)
|
|
|
|
def to_encoach_dict(self):
|
|
self.ensure_one()
|
|
return {
|
|
"id": self.id,
|
|
"user": self.user_id.id,
|
|
"date": self.date.isoformat() if self.date else None,
|
|
**(self.exam_data or {}),
|
|
}
|