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:
1
encoach_classroom/models/__init__.py
Normal file
1
encoach_classroom/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import group
|
||||
36
encoach_classroom/models/group.py
Normal file
36
encoach_classroom/models/group.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class EncoachGroup(models.Model):
|
||||
_name = "encoach.group"
|
||||
_description = "EnCoach Classroom Group"
|
||||
|
||||
name = fields.Char(required=True)
|
||||
admin_id = fields.Many2one("res.users", string="Admin", required=True)
|
||||
participant_ids = fields.Many2many(
|
||||
"res.users", "encoach_group_participant_rel", "group_id", "user_id",
|
||||
string="Participants",
|
||||
)
|
||||
disable_editing = fields.Boolean(default=False)
|
||||
entity_id = fields.Many2one("encoach.entity", index=True)
|
||||
legacy_id = fields.Char(index=True)
|
||||
participant_count = fields.Integer(
|
||||
string="Participants",
|
||||
compute="_compute_participant_count",
|
||||
store=False,
|
||||
)
|
||||
|
||||
def _compute_participant_count(self):
|
||||
for rec in self:
|
||||
rec.participant_count = len(rec.participant_ids)
|
||||
|
||||
def to_encoach_dict(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
"id": self.id,
|
||||
"name": self.name,
|
||||
"admin": self.admin_id.id,
|
||||
"participants": self.participant_ids.ids,
|
||||
"disableEditing": self.disable_editing,
|
||||
"entity": self.entity_id.id if self.entity_id else None,
|
||||
}
|
||||
Reference in New Issue
Block a user