I'm trying to generate an XML report but I'm getting the following error:
Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch result = request.dispatch() File "/home/odoo/src/odoo/odoo/http.py", line 813, in dispatch r = self._call_function(**self.params) File "/home/odoo/src/odoo/odoo/http.py", line 370, in call_function return checked_call(self.db, *args, **kwargs) File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "/home/odoo/src/odoo/odoo/http.py", line 358, in checked_call result = self.endpoint(*a, **kw) File "/home/odoo/src/odoo/odoo/http.py", line 919, in call return self.method(*args, **kw) File "/home/odoo/src/odoo/odoo/http.py", line 544, in response_wrap response = f(*args, **kw) File "/home/odoo/src/user/report_xlsx/controllers/main.py", line 31, in report_routes xlsx = report.with_context(context).render_xlsx(docids, data=data)[0] File "/home/odoo/src/user/report_xlsx/models/ir_report.py", line 18, in render_xlsx raise UserError(("%s model was not found") % report_model_name) Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch result = request.dispatch() File "/home/odoo/src/odoo/odoo/http.py", line 813, in dispatch r = self._call_function(**self.params) File "/home/odoo/src/odoo/odoo/http.py", line 370, in call_function return checked_call(self.db, *args, **kwargs) File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "/home/odoo/src/odoo/odoo/http.py", line 358, in checked_call result = self.endpoint(*a, **kw) File "/home/odoo/src/odoo/odoo/http.py", line 919, in call return self.method(*args, **kw) File "/home/odoo/src/odoo/odoo/http.py", line 544, in response_wrap response = f(*args, **kw) File "/home/odoo/src/user/report_xlsx/controllers/main.py", line 31, in report_routes xlsx = report.with_context(context).render_xlsx(docids, data=data)[0] File "/home/odoo/src/user/report_xlsx/models/ir_report.py", line 18, in render_xlsx raise UserError(("%s model was not found") % report_model_name) odoo.exceptions.UserError: report.False model was not found
This is the action I created:
xmlCopy codeid="action_report_saldos_y_movimientos_wizard" model="ir.actions.report"> name="name">MATRIMAR | Reporte saldos y movimientos name="model">reporte_saldos_y_movimientos_wizard name="report_type">xlsx name="report_name"> report.matrimar_reporte_de_saldos_y_movimientos.plantilla_excel name="report_file"> report.matrimar_reporte_de_saldos_y_movimientos.plantilla_excel name="binding_type">report
This is the model to generate the report:
pythonCopy codeclass ReporteDeSaldosYMovimientosExcel(models.AbstractModel): _name = 'report.matrimar_reporte_de_saldos_y_movimientos.plantilla_excel' _description = 'MATRIMAR | Reporte excel de saldos y movimientos' _inherit = 'report.report_xlsx.abstract' def generate_xlsx_report(self, workbook, data, partners): _logger.info(f'{data=} {partners=}') pass
And this is the model of the wizard where I call the report:
pythonCopy codeclass ReporteDeSaldosYMovimientosWizard(models.TransientModel): _name = 'reporte_saldos_y_movimientos_wizard' _description = 'MATRIMAR | Saldos y movimientos - Reporte' partner_id = fields.Many2one( 'res.partner', string='Cliente', ) fecha = fields.Date() def generar_reporte_pdf(self): _logger.info('No definido') def generar_reporte_excel(self): _logger.info('Generando archivo de excel') data = { 'form_data': self.read()[0] } return self.env.ref('matrimar_reporte_de_saldos_y_movimientos.action_report_saldos_y_movimientos_wizard').report_ac
Hi,
There is a little confusion in your question. In the heading, you are saying that issue is in the Excel report. But in the beginning of the paragraph, you are saying that issue is with generating XML files.
Anyway you can refer the below links for both
For XML report : https://www.cybrosys.com/blog/how-to-create-and-export-xml-reports-in-odoo
For Excel reports: https://www.cybrosys.com/blog/how-to-create-excel-report-using-controller-in-odoo-15
I hope this will help you.