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:
45
encoach_core/models/permission.py
Normal file
45
encoach_core/models/permission.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from odoo import models, fields
|
||||
|
||||
PERMISSION_TOPICS = [
|
||||
("exam", "Exam Management"),
|
||||
("user", "User Management"),
|
||||
("entity", "Entity Management"),
|
||||
("group", "Group Management"),
|
||||
("assignment", "Assignment Management"),
|
||||
("code", "Code Management"),
|
||||
("invite", "Invite Management"),
|
||||
("payment", "Payment Management"),
|
||||
("ticket", "Ticket Management"),
|
||||
("approval", "Approval Workflow"),
|
||||
("stats", "Statistics"),
|
||||
("training", "Training"),
|
||||
]
|
||||
|
||||
PERMISSION_TYPES = [
|
||||
("create", "Create"),
|
||||
("read", "Read"),
|
||||
("update", "Update"),
|
||||
("delete", "Delete"),
|
||||
]
|
||||
|
||||
|
||||
class EncoachPermission(models.Model):
|
||||
_name = "encoach.permission"
|
||||
_description = "EnCoach Permission"
|
||||
|
||||
topic = fields.Selection(PERMISSION_TOPICS, required=True)
|
||||
perm_type = fields.Selection(PERMISSION_TYPES, required=True)
|
||||
legacy_id = fields.Char(index=True)
|
||||
|
||||
_topic_type_unique = models.Constraint(
|
||||
"UNIQUE(topic, perm_type)",
|
||||
"Permission topic/type combination must be unique.",
|
||||
)
|
||||
|
||||
def to_encoach_dict(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
"id": self.id,
|
||||
"topic": self.topic,
|
||||
"type": self.perm_type,
|
||||
}
|
||||
Reference in New Issue
Block a user