I want to create a report for get list of attendance within date periods . I used wizard for it.
as a first step , I tried
after submit form print all attendance.
report is generated succesfully but no data in the pdf.
please help me how to pass data to report
wizard folder
create_food_allowance.py
class createreport(models.Model):
_name = 'lankaspin_allowances.createreport'
_description = 'Create Food Allowance Wizard'
start_date = fields.Date('Start Date')
end_date= fields.Date('End Date')
def print_report(self):
data = {
'model': 'lankaspin_allowances.createreport',
'form': self.read()[0]
}
print(data['form']['start_date'])
attendence = self.env['hr.attendance'].search([])
attendence_list = []
for app in attendence:
vals = {
'check_in': app.check_in,
'check_out': app.check_out,
}
attendence_list.append(vals)
data['attendence'] =attendence_list
print(data)
return self.env.ref('lankaspin_allowances.food_allowance_report').with_context(landscape=True).report_action(self, data=data)
Report folder
report template
<template id="print_food_allowance_report">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<div class="oe_structure"/>
<div class="row">
<table class="table ">
<thead>
<tr>
<th style="text-align:left;"><strong>Check_in</strong></th>
<th style="text-align:left;"><strong>Check_out </strong></th>
<th style="text-align:left;"><strong>Signature</strong></th>
</tr>
</thead>
<tbody>
<t t-foreach="attendence" t-as="o">
<tr>
<td style="text-align:left;">
<t t-esc="o['check_in']"/>
</td>
<td style="text-align:left;">
<t t-esc="o['check_out']"/>
</td>
<td style="text-align:left;">
sss
</td>
</tr>
</t>
<tr>
<td style="text-align:left;">
shah
</td>
<td style="text-align:left;">
dddd
</td>
<td style="text-align:left;">
sss
</td>
</tr>
</tbody>
</table>
</div>
</div>
</t>
</t>
</template>
report menu
<report
id="food_allowance_report"
string="Appointment"
model="lankaspin_allowances.createreport"
report_type="qweb-pdf"
name="lankaspin_allowances.print_food_allowance_report"
file="lankaspin_allowances.print_food_allowance_report"/>