Files
Yamen Ahmad 3e83d8d7d5 feat: add complete EnCoach backend — Odoo 19 + all addons
Includes:
- Odoo 19 framework (odoo/)
- 27 custom EnCoach addons (new_project/custom_addons/)
  - encoach_core, encoach_api, encoach_lms_api, encoach_adaptive_api
  - encoach_exam, encoach_taxonomy, encoach_adaptive, encoach_assignment
  - encoach_ai, encoach_ai_grading, encoach_ai_generation, encoach_ai_media
  - encoach_courseware, encoach_communication, encoach_subscription
  - encoach_notification, encoach_approval, encoach_branding
  - encoach_classroom, encoach_registration, encoach_stats
  - encoach_faq, encoach_ticket, encoach_training, encoach_resources
  - encoach_adaptive_ai, encoach_sis
- 21 OpenEduCat Enterprise modules (new_project/enterprise-19/)
- 14 OpenEduCat Community modules (new_project/openeducat_erp-19.0/)
- Configuration: odoo.conf, requirements.txt, scripts
- 200+ REST API endpoints with JWT authentication
- SRS and test documentation

Made-with: Cursor
2026-04-01 17:10:04 +04:00

96 lines
2.9 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.tools.translate import html_translate
class Website(models.Model):
_inherit = "website"
name_translated = fields.Char(translate=True)
class TestModel(models.Model):
_name = 'test.model'
_inherit = [
'website.seo.metadata',
'website.published.mixin',
'website.searchable.mixin',
]
_description = 'Website Model Test'
name = fields.Char(required=True, translate=True)
submodel_ids = fields.One2many('test.submodel', 'test_model_id', "Submodels")
website_description = fields.Html(
string="Description for the website",
translate=html_translate,
sanitize_overridable=True,
sanitize_attributes=False,
sanitize_form=False,
default="""<div class="o_test_website_description"><p>A simple website description content.</p></div>""",
)
tag_id = fields.Many2one('test.tag')
@api.model
def _search_get_detail(self, website, order, options):
return {
'model': 'test.model',
'base_domain': [],
'search_fields': ['name', 'submodel_ids.name', 'submodel_ids.tag_id.name'],
'fetch_fields': ['name'],
'mapping': {
'name': {'name': 'name', 'type': 'text', 'match': True},
'website_url': {'name': 'name', 'type': 'text', 'truncate': False},
},
'icon': 'fa-check-square-o',
'order': 'name asc, id desc',
}
def open_website_url(self):
self.ensure_one()
return self.env['website'].get_client_action(f'/test_model/{self.id}')
class TestSubmodel(models.Model):
_name = 'test.submodel'
_description = 'Website Submodel Test'
name = fields.Char(required=True)
test_model_id = fields.Many2one('test.model')
tag_id = fields.Many2one('test.tag')
class TestTag(models.Model):
_name = 'test.tag'
_description = 'Website Tag Test'
name = fields.Char(required=True)
class TestModelMultiWebsite(models.Model):
_name = 'test.model.multi.website'
_inherit = [
'website.published.multi.mixin',
]
_description = 'Multi Website Model Test'
name = fields.Char(required=True)
# `cascade` is needed as there is demo data for this model which are bound
# to website 2 (demo website). But some tests are unlinking the website 2,
# which would fail if the `cascade` is not set. Note that the website 2 is
# never set on any records in all other modules.
website_id = fields.Many2one('website', string='Website', ondelete='cascade')
class TestModelExposed(models.Model):
_name = 'test.model.exposed'
_inherit = [
'website.seo.metadata',
'website.published.mixin',
]
_description = 'Website Model Test Exposed'
_rec_name = "name"
name = fields.Char()