Saturday, June 15, 2024
1 change · saas-17.1
Resolved issues and error corrections
Applying analytic filters to certain financial reports, such as the Belgian Balance Sheet, no longer causes an error. This ensures users can filter reports by analytic accounts reliably without interrupting reporting workflows.
Original PR description
Currently, applying an analytic filter on a report that uses the `account_codes` report engine results in a traceback. ### Steps to reproduce * install `l10n_be_reports` * enable Analytic Filter on the Balance Sheet report * Attempt to apply an analytic filter on the Balance Sheet You will encounter a traceback: `psycopg2.ProgrammingError: can't adapt type 'SQL'` ### Cause Commit odoo/odoo@467cabacc49893c433e69ca7a2cd65add068098b introduced new SQL queries using the `SQL()` wrapper. However, these `SQL()` wrapped queries are being mixed with regular string queries and end up being used as parameters for `cr.execute()`, which produces the error. In our case, an `SQL()` object appears in the `where_params` returned by `_query_get()`. This happens because `_query_analytic_accounts()` returns an `SQL()` query here: https://github.com/odoo/enterprise/blob/59d3fd53bfbc0d6a02ff89803563b146127f0e27/account_reports/models/account_analytic_report.py#L192 opw-3949658