from odoo import http from odoo.http import request from odoo.tools import misc class EmployeeJodController(http.Controller): @http.route("/download/employee_jod/", type="http", auth="user") def download_employee_jod_form(self, employee_id, **kwargs): employee = request.env["hr.employee"].sudo().browse(employee_id) if not employee.exists(): return request.not_found() template = request.env.ref("employee_jod.emp_joining_form_template", raise_if_not_found=False) if not template: return "Error: Template not found" return request.env["ir.qweb"]._render(template.id, { "docs": employee, "doc": employee, "time": misc.datetime, "user": request.env.user, })