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
29 lines
838 B
Python
29 lines
838 B
Python
from odoo import models, fields
|
|
|
|
|
|
class EncoachTraining(models.Model):
|
|
_name = "encoach.training"
|
|
_description = "EnCoach Training Record"
|
|
|
|
user_id = fields.Many2one(
|
|
"res.users", string="User", required=True, ondelete="cascade",
|
|
)
|
|
exams = fields.Json()
|
|
tips = fields.Json()
|
|
weak_areas = fields.Json()
|
|
created_at = fields.Datetime(default=fields.Datetime.now)
|
|
legacy_id = fields.Char(index=True)
|
|
|
|
def to_encoach_dict(self):
|
|
self.ensure_one()
|
|
return {
|
|
"id": self.id,
|
|
"userId": self.user_id.id if self.user_id else None,
|
|
"exams": self.exams,
|
|
"tips": self.tips,
|
|
"weakAreas": self.weak_areas,
|
|
"createdAt": (
|
|
self.created_at.isoformat() if self.created_at else None
|
|
),
|
|
}
|