diff --git a/odex25_hr/attendances/i18n/ar_001.po b/odex25_hr/attendances/i18n/ar_001.po
index fae51a1aa..d1cdc942b 100644
--- a/odex25_hr/attendances/i18n/ar_001.po
+++ b/odex25_hr/attendances/i18n/ar_001.po
@@ -500,9 +500,15 @@ msgstr "الموظف الأساسي"
#. module: attendances
#: model:ir.model.fields.selection,name:attendances.selection__days_off__shift__both
+#: model:ir.model.fields.selection,name:attendances.selection__employee_attendance_report__shift_mode__both
msgid "Both"
msgstr "الشفتين معا"
+#. module: attendances
+#: model:ir.model.fields.selection,name:attendances.selection__employee_attendance_report__shift_mode__both
+msgid "Both"
+msgstr "الأول والثاني معا"
+
#. module: attendances
#: model_terms:ir.ui.view,arch_db:attendances.view_attendance_transaction_filter
msgid "Date"
@@ -944,6 +950,11 @@ msgstr "جهاز بصمة"
msgid "Fingerprint Number"
msgstr "رقم البصمة"
+#. module: attendances
+#: model:ir.model.fields.selection,name:attendances.selection__employee_attendance_report__shift_mode__first
+msgid "First"
+msgstr "الأول"
+
#. module: attendances
#: model:ir.model.fields.selection,name:attendances.selection__attendance_special_days__shift__one
#: model:ir.model.fields.selection,name:attendances.selection__days_off__shift__one
@@ -1792,13 +1803,18 @@ msgstr "إرجاع الى المبدئي"
#. module: attendances
#: code:addons/attendances/wizard/attendances_report_wiz.py:0
-#: code:addons/odoo/STANDARD_MODULES/test/odex25_hr/odex25_hr/attendances/wizard/attendances_report_wiz.py:0
#: model:ir.model.fields,field_description:attendances.field_attendance_special_days__shift
#: model:ir.model.fields,field_description:attendances.field_days_off__shift
+#: model:ir.model.fields,field_description:attendances.field_employee_attendance_report__shift_mode
#, python-format
msgid "Shift"
msgstr "الشفت"
+#. module: attendances
+#: model:ir.model.fields,field_description:attendances.field_employee_attendance_report__shift_mode
+msgid "Shift"
+msgstr "الدوام"
+
#. module: attendances
#: model:ir.model.fields,field_description:attendances.field_resource_calendar__shift_day_off
msgid "Shift Day Off"
@@ -2466,6 +2482,11 @@ msgstr "خارج الدوام"
msgid "report.attendances.general_attendance_xls"
msgstr ""
+#. module: attendances
+#: model:ir.model.fields.selection,name:attendances.selection__employee_attendance_report__shift_mode__second
+msgid "second"
+msgstr "الثاني"
+
#. module: attendances
#: model:ir.model.fields.selection,name:attendances.selection__hr_attendance_transaction__attending_type__in_cal
msgid "within Calendar"
diff --git a/odex25_hr/attendances/wizard/attendances_report_view.xml b/odex25_hr/attendances/wizard/attendances_report_view.xml
index 1c0122922..ff84bf240 100644
--- a/odex25_hr/attendances/wizard/attendances_report_view.xml
+++ b/odex25_hr/attendances/wizard/attendances_report_view.xml
@@ -18,7 +18,12 @@
-
+
+
+
+
+
+
diff --git a/odex25_hr/attendances/wizard/attendances_report_wiz.py b/odex25_hr/attendances/wizard/attendances_report_wiz.py
index 0bb7b2ae0..bc84b895a 100644
--- a/odex25_hr/attendances/wizard/attendances_report_wiz.py
+++ b/odex25_hr/attendances/wizard/attendances_report_wiz.py
@@ -36,6 +36,12 @@ class AttendancesReport(models.TransientModel):
("employee", "Employee"),
], default="late", required=True)
print_totals_only = fields.Boolean(string="Totals only (one line per employee)", default=False)
+ shift_mode = fields.Selection(string="Shift", selection=[
+ ('first', 'First'),
+ ('second', 'second'),
+ ('both', 'Both'),
+ ], default='both', required=True)
+
def _payload(self):
return {
@@ -48,6 +54,7 @@ class AttendancesReport(models.TransientModel):
"employee_ids": self.employee_ids.ids,
"type": self.type,
"print_totals_only": self.print_totals_only,
+ "shift_mode": self.shift_mode,
},
}
@@ -63,7 +70,6 @@ class AttendancesReport(models.TransientModel):
if not self.employee_ids:
raise ValidationError(_("Please select Employees Name"))
if self.print_totals_only == True:
- print("hhhhhhhhhhfff")
return self.env.ref("attendances.action_totals_only_attendance_reportt").report_action(self, data=self._payload())
else:
return self.env.ref("attendances.action_general_attendance_reportt").report_action(self, data=self._payload())
@@ -83,6 +89,7 @@ class ReportAttendancePublic(models.AbstractModel):
def get_value(self, data):
type = data['form']['type']
+ shift_mode = data['form']['shift_mode']
print("ggg")
totals_only = data["form"].get("print_totals_only", False)
employee_ids = data['form']['employee_ids']
@@ -123,6 +130,11 @@ class ReportAttendancePublic(models.AbstractModel):
for key, value in grouped_data.items():
emp_data_dict[key] = list(value)
if type == 'late':
+ if shift_mode != 'both':
+ if shift_mode == 'first':
+ attendance_transaction_ids = attendance_transaction_ids.filtered(lambda r: r.sequence == 1)
+ elif shift_mode == 'second':
+ attendance_transaction_ids = attendance_transaction_ids.filtered(lambda r: r.sequence == 2)
for resource in attendance_transaction_ids:
note = ''
if resource.is_absent:
@@ -153,11 +165,11 @@ class ReportAttendancePublic(models.AbstractModel):
'note': note,
'department': resource.employee_id.department_id.name,
'employee_number': resource.employee_number,
- 'calendar_id': resource.calendar_id.name,
+ 'calendar_id': f"{resource.sequence} - {resource.calendar_id.name}" if resource.sequence else resource.calendar_id.name,
'employee_id': resource.employee_id,
- 'employee_name': resource.employee_id.name,
+ 'employee_name': resource.employee_id.name
})
- data = sorted(data, key=lambda d: d['date'])
+ data = sorted(data, key=lambda d: (d['date'], d['calendar_id']))
for emp in employees:
list_cat = attendance_transaction_ids.filtered(lambda r: r.employee_id.name == emp)
total_lateness = sum(list_cat.mapped('lateness'))