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
54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
from odoo import models, fields
|
|
|
|
|
|
class EncoachTicket(models.Model):
|
|
_name = "encoach.ticket"
|
|
_description = "EnCoach Support Ticket"
|
|
|
|
reporter_name = fields.Char()
|
|
reporter_email = fields.Char()
|
|
subject = fields.Char(required=True)
|
|
description = fields.Text()
|
|
ticket_type = fields.Selection(
|
|
[
|
|
("feedback", "Feedback"),
|
|
("bug", "Bug Report"),
|
|
("help", "Help Request"),
|
|
],
|
|
string="Type",
|
|
)
|
|
status = fields.Selection(
|
|
[
|
|
("open", "Open"),
|
|
("in_progress", "In Progress"),
|
|
("resolved", "Resolved"),
|
|
("closed", "Closed"),
|
|
],
|
|
default="open",
|
|
)
|
|
exam_information = fields.Json()
|
|
assigned_to_id = fields.Many2one(
|
|
"res.users", string="Assigned To", ondelete="set null",
|
|
)
|
|
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,
|
|
"reporterName": self.reporter_name or "",
|
|
"reporterEmail": self.reporter_email or "",
|
|
"subject": self.subject or "",
|
|
"description": self.description or "",
|
|
"type": self.ticket_type or "",
|
|
"status": self.status,
|
|
"examInformation": self.exam_information,
|
|
"assignedTo": (
|
|
self.assigned_to_id.name if self.assigned_to_id else None
|
|
),
|
|
"createdAt": (
|
|
self.created_at.isoformat() if self.created_at else None
|
|
),
|
|
}
|