training report

This commit is contained in:
Esraa-Exp 2025-04-13 13:48:18 +02:00
parent d09d2b22e1
commit b07cc412f5
2 changed files with 20 additions and 16 deletions

View File

@ -156,7 +156,7 @@ class EmployeeTrainingReport(models.AbstractModel):
(_('Join Date')), (_('Line Manager')), (_('Title Of Course')), (_('Course Organization')),
(_('Course Location')),
(_('Cost Of Course')), (_('Cost Of Ticket')), (_('Cost Of Day')), (_('Total Cost')), (_('Date Of Course')),
(_('End Training')), (_('Period Of Course')), (_('Status'))]
(_('End Training')), (_('Period Of Course')),(_('Total Hours')), (_('Status'))]
return [labels, records]
@api.model
@ -202,6 +202,8 @@ class EmployeeMissionTrainingReportXlsx(models.AbstractModel):
format2 = workbook.add_format(
{'font_size': 14, 'bottom': True, 'right': True, 'left': True, 'top': True, 'align': 'center',
'bold': True, 'bg_color': '#ffffff', 'font_color': 'black'})
date_format = workbook.add_format({'num_format': 'dd-mm-yyyy', 'align': 'center'})
format2.set_align('center')
sheet.merge_range('A9:S9',
@ -235,10 +237,10 @@ class EmployeeMissionTrainingReportXlsx(models.AbstractModel):
sheet.write(row, clm, seq, format1)
sheet.write(row, clm + 1, rec.employee_id.emp_no, format1)
sheet.write(row, clm + 2, rec.employee_id.name, format1)
sheet.write(row, clm + 3, rec.employee_id.working_location, format1)
sheet.write(row, clm + 3, rec.employee_id.working_location.name, format1)
sheet.write(row, clm + 4, rec.employee_id.department_id.name, format1)
sheet.write(row, clm + 5, rec.employee_id.job_id.name, format1)
sheet.write(row, clm + 6, rec.employee_id.first_hiring_date, format1)
sheet.write(row, clm + 6, rec.employee_id.first_hiring_date, date_format)
sheet.write(row, clm + 7, rec.employee_id.parent_id.name, format1)
sheet.write(row, clm + 8, rec.official_mission_id.course_name.name, format1)
sheet.write(row, clm + 9, rec.official_mission_id.partner_id.name, format1)
@ -247,15 +249,14 @@ class EmployeeMissionTrainingReportXlsx(models.AbstractModel):
sheet.write(row, clm + 12, round(ticket, 2), format1)
sheet.write(row, clm + 13, round(rec.day_price, 2), format1)
sheet.write(row, clm + 14, (rec.day_price + rec.train_cost_emp), format1)
sheet.write(row, clm + 15, rec.date_from, format1)
sheet.write(row, clm + 16, rec.date_to, format1)
sheet.write(row, clm + 17, str(rec.hours) + " " + (
_("Hour")) if rec.official_mission_id.mission_type.duration_type == 'hours'
else str(rec.days) + " " + (_("Day")), format1)
sheet.write(row, clm + 15, rec.date_from, date_format)
sheet.write(row, clm + 16, rec.date_to, date_format)
sheet.write(row, clm + 17, str(rec.hours) + " " + (_("Days")))
sheet.write(row, clm + 18, str(rec.days) + " " + (_("Hour")))
if self.env.user.lang != 'en_US':
sheet.write(row, clm + 18, stages[rec.official_mission_id.state], format1)
sheet.write(row, clm + 19, stages[rec.official_mission_id.state], format1)
else:
sheet.write(row, clm + 18,
sheet.write(row, clm + 19,
dict(rec.official_mission_id._fields['state'].selection).get(rec.official_mission_id.state),
format1)
row += 1

View File

@ -194,7 +194,7 @@
<span t-esc="o.employee_id.name"/>
</td>
<td>
<t t-esc="o.employee_id.working_location"/>
<t t-esc="o.employee_id.working_location.name"/>
</td>
<td>
<t t-esc="o.employee_id.department_id.name"/>
@ -237,16 +237,19 @@
<span t-esc="o.date_to"/>
</td>
<td>
<t>
<span t-esc="o.days"/>
Day
</t>
<t t-if="o.official_mission_id.mission_type.duration_type == 'hours'">
<td>
<t>
<span t-esc="o.hours"/>
Hour
</t>
<t t-if="o.official_mission_id.mission_type.duration_type == 'days'">
<span t-esc="o.days"/>
Day
</t>
</td>
</td>
<td>