I added wizard to select two dates and send data from wizard to report
this wizard is hown when i click on تبرير غياب submenu i need to get name of employee of this hr.employee (Ernest Reed) to print it in report with the data given from wizard how can i do that?
wizard code:
class AbsencePrintWizard(models.TransientModel):
_name = 'absence.print.wizard'
_description = 'Employee Print Wizard'
date_from=fields.Date()
date_to=fields.Date()
employee_id=fields.Many2one('hr.employee')
absence_days = fields.Integer(compute="compute_absence_days")
annual_timeoff_days=fields.Integer(compute="compute_annual_timeoff_days")
remaining_annual_timeoff_days=fields.Integer(compute="compute_annual_timeoff_days")
emergency_timeoff_days = fields.Integer(compute="compute_emergency_timeoff_days")
remaining_emergency_timeoff_days = fields.Integer(compute="compute_emergency_timeoff_days")
absence_days_in_year=fields.Integer(compute="compute_absence_days")
def print_report(self):
data={
'name':self.employee_id.name,
'job':self.employee_id.job_title,
'work_location':self.employee_id.work_location_id.name,
'absence_days':self.absence_days,
'total_annual_timeoff':self.annual_timeoff_days,
'remaining_annual_timeoff_days':self.remaining_annual_timeoff_days,
'total_emergency_timeoff':self.emergency_timeoff_days,
'remaining_emergency_timeoff_days':self.remaining_emergency_timeoff_days,
'create_date':self.create_date.date(),
'year':self.create_date.date().year,
'absence_days_in_year':self.absence_days_in_year,
}
return self.env.ref('gescoly_timeoff.Absence_leave_report_id').report_action(self,data=data)