Files
full_encoach_platform/odoo/addons/hr/models/hr_mixin.py
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

27 lines
1.1 KiB
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from .hr_employee import _ALLOW_READ_HR_EMPLOYEE
class HrMixin(models.AbstractModel):
_name = _description = 'hr.mixin'
# Those overrides deal with many2many fields to comodel 'hr.employee'. In
# the past, one could assign such a many2many field without having any
# access to its comodel. Since Odoo 19, one must have read access to the
# comodel to modify the relation. The hack consists in passing a special
# value in the context, and pretend 'hr.employee' records to be readable
# when that value is present.
@api.model_create_multi
def create(self, vals_list):
special_self = self.with_context(_allow_read_hr_employee=_ALLOW_READ_HR_EMPLOYEE)
records = super(HrMixin, special_self).create(vals_list)
return records.with_env(self.env)
def write(self, vals):
special_self = self.with_context(_allow_read_hr_employee=_ALLOW_READ_HR_EMPLOYEE)
return super(HrMixin, special_self).write(vals)