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/__init__.py
Normal file
1
encoach_classroom/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
13
encoach_classroom/__manifest__.py
Normal file
13
encoach_classroom/__manifest__.py
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "EnCoach Classroom",
|
||||
"version": "19.0.1.0.0",
|
||||
"category": "Education",
|
||||
"summary": "Classroom groups for the EnCoach platform",
|
||||
"depends": ["encoach_core"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/group_views.xml",
|
||||
],
|
||||
"installable": True,
|
||||
"license": "LGPL-3",
|
||||
}
|
||||
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,
|
||||
}
|
||||
5
encoach_classroom/security/ir.model.access.csv
Normal file
5
encoach_classroom/security/ir.model.access.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_encoach_group_student,encoach.group.student,model_encoach_group,encoach_core.group_encoach_student,1,0,0,0
|
||||
access_encoach_group_teacher,encoach.group.teacher,model_encoach_group,encoach_core.group_encoach_teacher,1,1,1,0
|
||||
access_encoach_group_admin,encoach.group.admin,model_encoach_group,encoach_core.group_encoach_admin,1,1,1,1
|
||||
access_encoach_group_sysadmin,encoach.group.sysadmin,model_encoach_group,base.group_system,1,1,1,1
|
||||
|
66
encoach_classroom/views/group_views.xml
Normal file
66
encoach_classroom/views/group_views.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="view_encoach_group_tree" model="ir.ui.view">
|
||||
<field name="name">encoach.group.tree</field>
|
||||
<field name="model">encoach.group</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Groups">
|
||||
<field name="name"/>
|
||||
<field name="admin_id"/>
|
||||
<field name="entity_id"/>
|
||||
<field name="disable_editing"/>
|
||||
<field name="participant_count" widget="badge"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_encoach_group_form" model="ir.ui.view">
|
||||
<field name="name">encoach.group.form</field>
|
||||
<field name="model">encoach.group</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Group">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="admin_id"/>
|
||||
<field name="entity_id"/>
|
||||
<field name="disable_editing"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Participants" name="participants">
|
||||
<field name="participant_ids">
|
||||
<list editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="login"/>
|
||||
<field name="email"/>
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_encoach_group" model="ir.actions.act_window">
|
||||
<field name="name">Groups</field>
|
||||
<field name="res_model">encoach.group</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
Create your first group.
|
||||
</p>
|
||||
<p>
|
||||
Groups organize participants in the classroom for assignments and exams.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_encoach_group"
|
||||
name="Groups"
|
||||
parent="encoach_core.menu_encoach_classroom"
|
||||
action="action_encoach_group"
|
||||
sequence="10"/>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user