add openeducat modules

This commit is contained in:
XuanHuyen
2025-05-05 09:03:48 +07:00
parent 4f8478d1e7
commit 0bf3600b22
1206 changed files with 317180 additions and 0 deletions
@@ -0,0 +1,21 @@
###############################################################################
#
# OpenEduCat Inc
# Copyright (C) 2009-TODAY OpenEduCat Inc(<https://www.openeducat.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import admission_analysis_report
@@ -0,0 +1,74 @@
###############################################################################
#
# OpenEduCat Inc
# Copyright (C) 2009-TODAY OpenEduCat Inc(<https://www.openeducat.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
import time
from odoo import api, models
class ReportAdmissionAnalysis(models.AbstractModel):
_name = "report.openeducat_admission.report_admission_analysis"
_description = "Admission Analysis Report"
def get_total_student(self, data):
student_search = self.env['op.admission'].search_count(
[('state', '=', 'done'),
('course_id', '=', data['course_id'][0]),
('admission_date', '>=', data['start_date']),
('admission_date', '<=', data['end_date'])])
return student_search
def get_data(self, data):
lst = []
student_search = self.env['op.admission'].search(
[('state', '=', 'done'),
('course_id', '=', data['course_id'][0]),
('admission_date', '>=', data['start_date']),
('admission_date', '<=', data['end_date'])],
order='admission_date desc')
res = {}
# self.total_student = 0
total_student = 0
for student in student_search:
# self.total_student += 1
total_student += 1
res = {
'name': student.name,
'application_no': student.application_number,
}
lst.append(res)
return lst
@api.model
def _get_report_values(self, docids, data=None):
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
docargs = {
'doc_ids': self.ids,
'doc_model': model,
'docs': docs,
'time': time,
'data': data,
'start_date': data['start_date'],
'end_date': data['end_date'],
'get_total_student': self.get_total_student(data),
'get_data': self.get_data(data),
}
return docargs
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_admission_analysis">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="font">
<div class="page">
<br></br>
<br></br>
<br></br>
<div class="text-center">
<h3>
<strong>Admission Analysis</strong>
</h3>
</div>
<div class="row mt24">
<div style="width:50%; margin-left:15px;">
<b>Course:</b>
<span t-out="'%s' % data['course_id'][1] if data['course_id'][1] else ''"/>
</div>
<div style="width:50%; margin-left:15px;">
<b>From Date:</b>
<span t-esc="data['start_date']" t-options="{'widget':'date'}"/>
<b>To Date:</b>
<span t-esc="data['end_date']" t-options="{'widget':'date'}"/>
</div>
</div>
<br></br>
<table class="table table-bordered">
<thead class="text-center"
style="background-color:#eeeeee; font-size:14px; font-weight:600;">
<th>Student Name</th>
<th>Application No.</th>
</thead>
<tbody class="text-center" style="font-size:12px;">
<tr t-foreach="get_data" t-as="data">
<td>
<span t-esc="data['name']"/>
</td>
<td>
<span t-out="'%s' %data['application_no'] if data['application_no'] else ''"/>
</td>
</tr>
</tbody>
</table>
<br></br>
<b>Total Number of Students :</b>
<span t-esc="get_total_student"/>
</div>
</div>
</t>
</t>
</template>
</odoo>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="action_report_report_admission_analysis" model="ir.actions.report">
<field name="name">Admission Analysis</field>
<field name="model">admission.analysis</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">openeducat_admission.report_admission_analysis</field>
<field name="report_file">openeducat_admission.report_admission_analysis</field>
</record>
</odoo>