Good Day! Can someone help me with my problem, I've created a report in odoo, the report has a user input to filter the report by employee and date period before generating the pdf report like Leave Per Department Report in Odoo but when the generated pdf is empty. Ive just replicate the Leaves per Department Report code.
Here's my Sample Code this is the Menu in Reporting Menu Transient Model
class payslip_per_Employee(models.TransientModel):
_name = 'payroll.payslip.employee'
employee_id = fields.Many2one('hr.employee', 'Employee', required=True)
month_of_from = fields.Selection(genx.MONTH_SELECTION, 'From the Month of', required=True, default = 1)
month_quarter_from = fields.Selection(MONTH_QUARTER_SELECTION, 'Month Quarter', required=True, default = 1)
month_year_from = fields.Integer('Year', required=True, default = genx.YEAR_NOW)
month_of_to = fields.Selection(genx.MONTH_SELECTION, 'To the Month of', required=True, default = 12)
month_quarter_to = fields.Selection(MONTH_QUARTER_SELECTION, 'Month Quarter', required=True, default = 2)
month_year_to = fields.Integer('Year', required=True, default = genx.YEAR_NOW)
def print_report(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, context=context)[0]
datas = {
'ids': [],
'model': 'ir.ui.menu',
'form': data
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'hr_payroll_ezra.report_payslip_employee',
'datas': datas,
}
My XML in Transient Model
<data>
<record id="view_payslip_per_employee" model="ir.ui.view">
<field name="name">payroll.payslip.employee.form</field>
<field name="model">payroll.payslip.employee</field>
<field name="arch" type="xml">
<form string="Payslip Employee">
<group>
<field name="employee_id" />
<field name="month_of_from"/>
<field name="month_quarter_from"/>
<field name="month_year_from"/>
<field name="month_of_to"/>
<field name="month_quarter_to"/>
<field name="month_year_to"/>
</group>
<footer>
<button name="print_report" string="Print" type="object" class="oe_highlight"/> or
<button string="Cancel" special="cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>`enter code here`
<record id="action_payslip_per_employee" model="ir.actions.act_window">
<field name="name">Payslip Employee</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">payroll.payslip.employee</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
name="Payslip Employee"
parent="hr.menu_hr_reporting_timesheet"
action="action_payslip_per_employee"
id="menu_payslip_per_employee"
icon="STOCK_PRINT"/>
</data>
My QWEB Report
<data>
<report
id="payroll_payslip_employee_ezra"
model="hr.payroll.detail"
string="Employee Payslip"
report_type="qweb-html"
name="hr_payroll_ezra.report_payslip_employee"
file="hr_payroll_ezra.report_payslip_employee"
attachment_use="True"
attachment="object.name+'.pdf'"/>
My QWEB Code is too long to post, did I miss something in passing the value to the reports? Please Help Thanks again for the help