EnCoach Odoo 19 custom modules
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
This commit is contained in:
2
encoach_evaluation/models/__init__.py
Normal file
2
encoach_evaluation/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import evaluation
|
||||
from . import ai_job
|
||||
34
encoach_evaluation/models/ai_job.py
Normal file
34
encoach_evaluation/models/ai_job.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class EncoachAIJob(models.Model):
|
||||
_name = "encoach.ai.job"
|
||||
_description = "EnCoach AI Background Job"
|
||||
|
||||
job_type = fields.Selection(
|
||||
[
|
||||
("writing_grading", "Writing Grading"),
|
||||
("speaking_grading", "Speaking Grading"),
|
||||
("video_generation", "Video Generation"),
|
||||
],
|
||||
string="Job Type",
|
||||
)
|
||||
status = fields.Selection(
|
||||
[
|
||||
("pending", "Pending"),
|
||||
("in_progress", "In Progress"),
|
||||
("completed", "Completed"),
|
||||
("error", "Error"),
|
||||
],
|
||||
default="pending",
|
||||
)
|
||||
user_id = fields.Many2one("res.users", string="User", ondelete="set null")
|
||||
evaluation_id = fields.Many2one(
|
||||
"encoach.evaluation", string="Evaluation", ondelete="cascade",
|
||||
)
|
||||
input_data = fields.Json()
|
||||
result_data = fields.Json()
|
||||
error_message = fields.Text()
|
||||
created_at = fields.Datetime(default=fields.Datetime.now)
|
||||
completed_at = fields.Datetime()
|
||||
retry_count = fields.Integer(default=0)
|
||||
45
encoach_evaluation/models/evaluation.py
Normal file
45
encoach_evaluation/models/evaluation.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class EncoachEvaluation(models.Model):
|
||||
_name = "encoach.evaluation"
|
||||
_description = "EnCoach Evaluation Record"
|
||||
|
||||
user_id = fields.Many2one("res.users", string="User", ondelete="cascade")
|
||||
session_id = fields.Integer(string="Session Reference")
|
||||
exercise_id = fields.Char(string="Exercise ID")
|
||||
exercise_type = fields.Selection(
|
||||
[("writing", "Writing"), ("speaking", "Speaking")],
|
||||
string="Exercise Type",
|
||||
)
|
||||
status = fields.Selection(
|
||||
[
|
||||
("pending", "Pending"),
|
||||
("in_progress", "In Progress"),
|
||||
("completed", "Completed"),
|
||||
("error", "Error"),
|
||||
],
|
||||
default="pending",
|
||||
)
|
||||
result = fields.Json()
|
||||
created_at = fields.Datetime(default=fields.Datetime.now)
|
||||
completed_at = fields.Datetime()
|
||||
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,
|
||||
"sessionId": self.session_id,
|
||||
"exerciseId": self.exercise_id or "",
|
||||
"exerciseType": self.exercise_type or "",
|
||||
"status": self.status,
|
||||
"result": self.result,
|
||||
"createdAt": (
|
||||
self.created_at.isoformat() if self.created_at else None
|
||||
),
|
||||
"completedAt": (
|
||||
self.completed_at.isoformat() if self.completed_at else None
|
||||
),
|
||||
}
|
||||
Reference in New Issue
Block a user