diff --git a/base_accounting_kit/__manifest__.py b/base_accounting_kit/__manifest__.py index 60ae17227..f84c2760f 100644 --- a/base_accounting_kit/__manifest__.py +++ b/base_accounting_kit/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Odoo 18 Full Accounting Kit for Community', - 'version': '18.0.5.0.7', + 'version': '18.0.5.0.8', 'category': 'Accounting', 'live_test_url': 'https://kit.easyinstance.com/web/login?redirect=/odoo/accounting', 'summary': """Odoo 18 Accounting, Odoo 18 Accounting Reports, Odoo18 Accounting, Odoo Accounting, Odoo18 Financial Reports, Odoo18 Asset, Odoo18 Profit and Loss, PDC, Followups, Odoo18, Accounting, Odoo Apps, Reports""", diff --git a/base_accounting_kit/controllers/statement_report.py b/base_accounting_kit/controllers/statement_report.py index 06798a81d..f027e217e 100644 --- a/base_accounting_kit/controllers/statement_report.py +++ b/base_accounting_kit/controllers/statement_report.py @@ -27,28 +27,47 @@ from odoo.tools import html_escape class XLSXReportController(http.Controller): """ Controller for xlsx report """ + @http.route('/xlsx_report', type='http', auth='user', methods=['POST'], csrf=False) - def get_report_xlsx(self, model, options, output_format, report_name): - """ Get xlsx report data """ - report_obj = request.env[model].sudo() - print("oo") - options = json.loads(options) + def get_report_xlsx(self, model, data, output_format, report_name, + report_action): + """Generate an XLSX report based on the provided data and return it as + a response. + Args: + model (str): The name of the model on which the report is based. + data (str): The data required for generating the report. + output_format (str): The desired output format for the report + (e.g., 'xlsx'). + report_name (str): The name to be given to the generated report + file. + Returns: + Response: The generated report file as a response. + Raises: + Exception: If an error occurs during report generation. + """ + uid = request.session.uid + report_obj = request.env[model].with_user(uid) + token = 'dummy-because-api-expects-one' try: if output_format == 'xlsx': response = request.make_response( - None, headers=[ + None, + headers=[ ('Content-Type', 'application/vnd.ms-excel'), - ('Content-Disposition', content_disposition( - report_name + '.xlsx'))]) - report_obj.get_xlsx_report(options, response) - response.set_cookie('fileToken', 'dummy token') - return response - except Exception as event: - serialize = http.serialize_exception(event) + ('Content-Disposition', + content_disposition(report_name + '.xlsx')) + ] + ) + report_obj.get_xlsx_report(data, response, report_name, + report_action) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = http.serialize_exception(e) error = { 'code': 200, 'message': 'Odoo Server Error', - 'data': serialize + 'data': se } return request.make_response(html_escape(json.dumps(error))) diff --git a/base_accounting_kit/doc/RELEASE_NOTES.md b/base_accounting_kit/doc/RELEASE_NOTES.md index 4800ba248..09da42278 100644 --- a/base_accounting_kit/doc/RELEASE_NOTES.md +++ b/base_accounting_kit/doc/RELEASE_NOTES.md @@ -54,3 +54,8 @@ #### Version 18.0.5.0.7 #### FIX - Fixed Transactions button redirection for bank and cash journals to display journal-specific transactions, and added reconciliation filter for the To Reconcile action. + +#### 03.12.2025 +#### Version 18.0.5.0.8 +#### FIX +- Fixed the issues in the controller while printing the xlsx report.