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
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import _, http
|
|
from odoo.exceptions import AccessError
|
|
from odoo.http import request
|
|
|
|
|
|
class BaseSetup(http.Controller):
|
|
@http.route('/base_setup/data', type='jsonrpc', auth='user')
|
|
def base_setup_data(self, **kw):
|
|
if not request.env.user.has_group('base.group_erp_manager'):
|
|
raise AccessError(_("Access Denied"))
|
|
|
|
cr = self.env.cr
|
|
cr.execute("""
|
|
SELECT count(*)
|
|
FROM res_users
|
|
WHERE active=true AND
|
|
share=false
|
|
""")
|
|
active_count = cr.dictfetchall()[0].get('count')
|
|
|
|
cr.execute("""
|
|
SELECT count(u.*)
|
|
FROM res_users u
|
|
WHERE active=true AND
|
|
share=false AND
|
|
NOT exists(SELECT 1 FROM res_users_log WHERE create_uid=u.id)
|
|
""")
|
|
pending_count = cr.dictfetchall()[0].get('count')
|
|
|
|
cr.execute("""
|
|
SELECT id, login
|
|
FROM res_users u
|
|
WHERE active=true AND
|
|
share=false AND
|
|
NOT exists(SELECT 1 FROM res_users_log WHERE create_uid=u.id)
|
|
ORDER BY id desc
|
|
LIMIT 10
|
|
""")
|
|
pending_users = cr.fetchall()
|
|
action_pending_users = request.env['res.users'].browse(
|
|
[uid for (uid, login) in pending_users])._action_show()
|
|
|
|
return {
|
|
'active_users': active_count,
|
|
'pending_count': pending_count,
|
|
'pending_users': pending_users,
|
|
'action_pending_users': action_pending_users,
|
|
}
|
|
|
|
@http.route('/base_setup/demo_active', type='jsonrpc', auth='user')
|
|
def base_setup_is_demo(self, **kwargs):
|
|
# We assume that if there's at least one module with demo data active, then the db was
|
|
# initialized with demo=True or it has been force-activated by the `Load demo data` button
|
|
# in the settings dashboard.
|
|
demo_active = bool(request.env['ir.module.module'].search_count([('demo', '=', True)]))
|
|
return demo_active
|