commit
e47a84ab97
|
|
@ -216,7 +216,7 @@ msgstr "تقرير الحضور"
|
|||
#: model:ir.ui.menu,name:attendances.attendance_report_emp_menu
|
||||
#: model:ir.ui.menu,name:attendances.parent_attendance_report_employee
|
||||
msgid "Attendance Reports"
|
||||
msgstr "تقرير الحضور و الانصراف"
|
||||
msgstr " تقرير الحضور و الانصراف للموظفين"
|
||||
|
||||
#. module: attendances
|
||||
#: model_terms:ir.ui.view,arch_db:attendances.attendance_view_filter
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@
|
|||
<template id="late_attendance_report_template">
|
||||
<div class="page" style="font-size:12pt" dir="rtl">
|
||||
<br/>
|
||||
<center><h2 style="font-weight:bold">تقرير تاخير و خروج مبكر</h2></center>
|
||||
<center><h2 style="font-weight:bold">تقرير بالحضور والانصراف تفصيلى</h2></center>
|
||||
<br/>
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
|
|
@ -176,21 +176,44 @@
|
|||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:10%;text-align:center">
|
||||
<t t-esc="line['day']"/>
|
||||
</td>
|
||||
<td style="border-right: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<td style="border:1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc= "'%02d:%02d' % (int(str(line['sig_in']).split('.')[0]), int(float(str('%.2f' % line['sig_in']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
<td style="border-right: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc= "'%02d:%02d' % (int(str(line['sig_out']).split('.')[0]), int(float(str('%.2f' % line['sig_out']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['lateness']).split('.')[0]), int(float(str('%.2f' % line['lateness']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['early_exit']).split('.')[0]), int(float(str('%.2f' % line['early_exit']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['extra_hours']).split('.')[0]), int(float(str('%.2f' % line['extra_hours']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
<t t-if=" line['lateness'] > 0">
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: red;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['lateness']).split('.')[0]), int(float(str('%.2f' % line['lateness']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['lateness']).split('.')[0]), int(float(str('%.2f' % line['lateness']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-if=" line['early_exit'] > 0">
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['early_exit']).split('.')[0]), int(float(str('%.2f' % line['early_exit']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: red;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['early_exit']).split('.')[0]), int(float(str('%.2f' % line['early_exit']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-if=" line['lateness'] > 0">
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: green;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['extra_hours']).split('.')[0]), int(float(str('%.2f' % line['extra_hours']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
|
||||
</t>
|
||||
<t t-else="">
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:5%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['extra_hours']).split('.')[0]), int(float(str('%.2f' % line['extra_hours']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
</t>
|
||||
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;width:10%;text-align:center">
|
||||
<t t-esc="'%02d:%02d' % (int(str(line['office_hours']).split('.')[0]), int(float(str('%.2f' % line['office_hours']).split('.')[1])/100*60))"/>
|
||||
</td>
|
||||
|
|
@ -206,45 +229,45 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<table class="table table-condensed" style="width:100%">
|
||||
<tr>
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
مجموع التأخير والتقصير
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_late_early']" />
|
||||
</td>
|
||||
<tr>
|
||||
<td style="border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
مجموع التأخير والتقصير
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_late_early']" />
|
||||
</td>
|
||||
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
اجمالى ايام الغياب
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_absent']" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style=" border: 1px solid gray; padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
اجمالى الاضافى
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_extra_hours']"/>
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
اجمالى الاجازات والانتدابات
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_leave']"/>
|
||||
</td>
|
||||
</tr>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
اجمالى ايام الغياب
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_absent']" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style=" border: 1px solid gray; padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
اجمالى الاضافى
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_extra_hours']"/>
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
اجمالى الاجازات والانتدابات
|
||||
</td>
|
||||
<td style=" border: 1px solid gray;padding: 1px;font-size:0.8em;background-color: white;color: black;text-align:center;">
|
||||
<t t-esc="total[key]['total_leave']"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</t>
|
||||
<table style="width:100%;float:center">
|
||||
<tr style="width:100%;">
|
||||
<td style="width:50%;color:black;text-align:center"><t t-esc="print_date"/></td>
|
||||
<td style="width:50%;color:black;text-align:center"><t t-esc="print_user"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="width:100%;float:center">
|
||||
<tr style="width:100%;">
|
||||
<td style="width:50%;color:black;text-align:center"><t t-esc="print_date"/></td>
|
||||
<td style="width:50%;color:black;text-align:center"><t t-esc="print_user"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
<template id="general_attendances_report_temp">
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
</group>
|
||||
<notebook>
|
||||
<page string="Employees" >
|
||||
<field name="employee_ids" nolabel="1">
|
||||
<field name="employee_ids" nolabel="1" required="1">
|
||||
<tree string="Employees" editable="bottom">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
<button string="Print Report" type="object" name="print_report" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Print Excel Report" invisible="1" type="object" name="print_excel_report" class="oe_highlight"/>
|
||||
or
|
||||
<!-- or-->
|
||||
<button special="cancel" string="Cancel" class="oe_link"/>
|
||||
</footer>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
import collections
|
||||
import datetime
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
week_dayS_arabic={0:"الاثنين", 1: 'الثلاثاء', 4:'الجمعة' , 2:'الاربعاء',3: 'الخميس', 6:'الاحد',5: 'السبت'}
|
||||
class AttendancesReport(models.TransientModel):
|
||||
|
|
@ -11,13 +12,15 @@ class AttendancesReport(models.TransientModel):
|
|||
|
||||
from_date = fields.Date(string='From Date', required=True)
|
||||
to_date = fields.Date(string='To Date', required=True)
|
||||
employee_ids = fields.Many2many(comodel_name='hr.employee', string='Employees')
|
||||
employee_ids = fields.Many2many(comodel_name='hr.employee', string='Employees' ,required=True)
|
||||
resource_calender_id = fields.Many2one(comodel_name='resource.calendar', string='Employee work record')
|
||||
type = fields.Selection(selection=[('late', 'Late and Early exit'), ('absent', 'Absent'), ('employee', 'Employee')],
|
||||
required=True,
|
||||
default='late', string='Type')
|
||||
|
||||
def print_report(self):
|
||||
if not self.employee_ids:
|
||||
raise ValidationError(_("Please select Employee"))
|
||||
data = {
|
||||
'ids': self.ids,
|
||||
'model': self._name,
|
||||
|
|
@ -94,7 +97,7 @@ class ReportAttendancePublic(models.AbstractModel):
|
|||
if resource.is_absent:
|
||||
note='غياب'
|
||||
elif resource.public_holiday:
|
||||
note=resource.public_holiday_id.official_event_id.name
|
||||
note="عطلة رسمية"
|
||||
elif resource.official_id:
|
||||
note = resource.official_id.official_event_id.name
|
||||
elif resource.normal_leave:
|
||||
|
|
@ -118,6 +121,8 @@ class ReportAttendancePublic(models.AbstractModel):
|
|||
'employee_id': resource.employee_id,
|
||||
'employee_name': resource.employee_id.name,
|
||||
})
|
||||
|
||||
data=sorted(data, key=lambda d: d['date'])
|
||||
for emp in employees:
|
||||
list_cat = attendance_transaction_ids.filtered(lambda r: r.employee_id.name == emp)
|
||||
total_lateness = sum(list_cat.mapped('lateness'))
|
||||
|
|
@ -134,7 +139,7 @@ class ReportAttendancePublic(models.AbstractModel):
|
|||
list_not_log_out = attendance_transaction_ids.filtered(
|
||||
lambda r: r.employee_id.name == emp and r.sign_out == 0.0)
|
||||
list_leave = attendance_transaction_ids.filtered(
|
||||
lambda r: r.employee_id.name == emp and (r.public_holiday or r.official_id or r.normal_leave or r.approve_personal_permission ))
|
||||
lambda r: r.employee_id.name == emp and (r.normal_leave or r.approve_personal_permission ))
|
||||
total_not_sig_out = len(list_not_log_out)
|
||||
total_leave = len(list_leave)
|
||||
total_dic[emp] = {'total_lateness': total_lateness, 'total_early_exit': total_early_exit,
|
||||
|
|
|
|||
Loading…
Reference in New Issue