Files
full_encoach_platform/odoo/addons/spreadsheet/controllers/main.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

46 lines
1.4 KiB
Python

import logging
from odoo import http
from odoo.http import request, Controller
logger = logging.getLogger(__name__)
class SpreadsheetController(Controller):
@http.route("/spreadsheet/log", type="jsonrpc", auth="user", methods=["POST"])
def log_action(self, action_type, datasources, **kw):
if datasources:
self._log_spreadsheet_export(action_type, request.env.uid, datasources)
def _log_spreadsheet_export(self, action_type, user_id, datasources):
if action_type not in ["download", "copy", "freeze", "print"]:
return
data = [src for datasource in datasources if (src := self._stringify_source(datasource))]
if not data:
return
logger.info(
"User %d exported (%s) spreadsheet data (%s) from %s",
user_id, action_type, "), (".join(data), request.httprequest.environ["REMOTE_ADDR"]
)
@staticmethod
def _stringify_source(source):
res_model = source.get("resModel")
if not res_model or res_model not in request.env:
return
if not (fields := source.get("fields", [])):
return
string = f"model: {res_model} with fields: [{','.join(fields)}]"
if groupby := source.get("groupby"):
string += f" grouped by [{','.join(groupby)}]"
if domain := source.get("domain"):
string += f" with domain {domain}"
return string