Initial commit: Odoomates Odoo packages (12 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:49:21 +02:00
commit 3b38c49bf0
526 changed files with 34983 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# from . import patient_card_xls

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_patient_id_card">
<t t-foreach="docs" t-as="o">
<t t-call="web.basic_layout">
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-xs-8">
<table class="table table-condensed" style="border: 3px solid black !important;">
<tr>
<td width="40%">
<p style="text-align:center;padding-top:10px;">
<img t-if="not o.image"
t-att-src="'/web/static/src/img/placeholder.png'" height="140"
border="1" width="120"/>
<img t-if="o.image"
t-att-src="'data:image/png;base64,%s' % to_text(o.image)"
height="140" border="1" width="120"/>
</p>
</td>
<td width="60%">
<table>
<tr>
<td colspan="3" class="text-center">
<span t-field="o.name"/>
</td>
</tr>
<tr>
<td>
<span>
<strong>Age:</strong>
</span>
</td>
<td>
<span>:</span>
</td>
<td>
<span t-field="o.age"/>
</td>
</tr>
<tr>
<td>
<span>
<strong>Reference:</strong>
</span>
</td>
<td>
<span>:</span>
</td>
<td>
<span t-field="o.reference"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
</t>
</t>
</template>
</odoo>

View file

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
import base64
import io
from odoo import models
class PatientCardXlsx(models.AbstractModel):
_name = 'report.om_hospital.report_patient_id_card_xls'
_inherit = 'report.report_xlsx.abstract'
def generate_xlsx_report(self, workbook, data, patients):
bold = workbook.add_format({'bold': True})
format_1 = workbook.add_format({'bold': True, 'align': 'center', 'bg_color': 'yellow'})
for obj in patients:
sheet = workbook.add_worksheet(obj.name)
row = 3
col = 3
sheet.set_column('D:D', 12)
sheet.set_column('E:E', 13)
row += 1
sheet.merge_range(row, col, row, col + 1, 'ID Card', format_1)
row += 1
if obj.image:
patient_image = io.BytesIO(base64.b64decode(obj.image))
sheet.insert_image(row, col, "image.png", {'image_data': patient_image, 'x_scale': 0.5, 'y_scale': 0.5})
row += 6
sheet.write(row, col, 'Name', bold)
sheet.write(row, col + 1, obj.name)
row += 1
sheet.write(row, col, 'Age', bold)
sheet.write(row, col + 1, obj.age)
row += 1
sheet.write(row, col, 'Reference', bold)
sheet.write(row, col + 1, obj.reference)
row += 2
sheet.merge_range(row, col, row + 1, col + 1, '', format_1)

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_patient_detail">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-xs-8">
<table class="table table-condensed" style="border: 3px solid black !important;">
<tr>
<td width="40%">
<p style="text-align:center;padding-top:10px;">
<img t-if="not o.image"
t-att-src="'/web/static/src/img/placeholder.png'" height="140"
border="1" width="120"/>
<img t-if="o.image"
t-att-src="'data:image/png;base64,%s' % to_text(o.image)"
height="140" border="1" width="120"/>
</p>
</td>
<td width="60%">
<table>
<tr>
<td colspan="3" class="text-center">
<span t-field="o.name"/>
</td>
</tr>
<tr>
<td>
<span>
<strong>Age:</strong>
</span>
</td>
<td>
<span>:</span>
</td>
<td>
<span t-field="o.age"/>
</td>
</tr>
<tr>
<td>
<span>
<strong>Reference:</strong>
</span>
</td>
<td>
<span>:</span>
</td>
<td>
<span t-field="o.reference"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<br/>
<t t-if="o.appointment_ids">
<span>Appointment Details</span>
<table class="table table-sm o_main_table" name="appointment">
<thead>
<tr>
<th name="th_reference" class="text-start">
<span>Reference</span>
</th>
<th name="th_age" class="text-start">
<span>Age</span>
</th>
<th name="th_doctor" class="text-start">
<span>Doctor</span>
</th>
</tr>
</thead>
<t t-set="appointment_count" t-value="0"/>
<t t-foreach="o.appointment_ids" t-as="line">
<t t-set="appointment_count" t-value="appointment_count + 1"/>
<tr>
<td>
<span t-field="line.name"/>
</td>
<td>
<span t-field="line.age"/>
</td>
<td>
<span t-field="line.doctor_id.doctor_name"/>
</td>
</tr>
</t>
<tr>
<td colspan="2">
<strong>Total Appointments</strong>
</td>
<td>
<t t-esc="appointment_count"/>
</td>
</tr>
</table>
</t>
</div>
</t>
</t>
</t>
</template>
</odoo>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="report_patient_details" model="ir.actions.report">
<field name="name">Patient Details</field>
<field name="model">hospital.patient</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">om_hospital.report_patient_detail</field>
<field name="report_file">om_hospital.report_patient_detail</field>
<field name="binding_model_id" ref="model_hospital_patient"/>
<field name="binding_type">report</field>
</record>
<record id="report_patient_card" model="ir.actions.report">
<field name="name">Patient Card</field>
<field name="model">hospital.patient</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">om_hospital.report_patient_id_card</field>
<field name="report_file">om_hospital.report_patient_id_card</field>
<field name="binding_model_id" ref="model_hospital_patient"/>
<field name="binding_type">report</field>
</record>
<!-- <record id="report_patient_card_xls" model="ir.actions.report">-->
<!-- <field name="name">Patient Card Excel</field>-->
<!-- <field name="model">hospital.patient</field>-->
<!-- <field name="report_type">xlsx</field>-->
<!-- <field name="report_name">om_hospital.report_patient_id_card_xls</field>-->
<!-- <field name="report_file">om_hospital.report_patient_id_card_xls</field>-->
<!-- <field name="binding_model_id" ref="model_hospital_patient"/>-->
<!-- <field name="binding_type">report</field>-->
<!-- </record>-->
</odoo>