[FW][FIX] account: fix error when opening duplicated Profit and Loss reports
Issue Duplicated Profit and Loss reports fail to open and raise an "invalid operation" error when accessed.
Steps to Reproduce
- Install the Accounting module and French localization.
- Go to Accounting > Configuration > Accounting > Accounting Reports.
- Duplicate the "Profit and Loss (2024)" report.
- Navigate to Accounting > Reporting > Profit and Loss.
- Attempt to open the duplicated report.
- An error occurs.
Root Cause During duplication, the label field of expressions is altered to include a " (copy)" suffix. Some formula expressions rely on exact label matches (e.g., i_1_2024.balance), so when "balance" becomes "balance (copy)", the lookup fails. This mismatch causes a KeyError when resolving subformulas like line_code.balance, breaking the report evaluation.
Fix Prevent the duplication process from altering the label of expressions. There is no functional need to add " (copy)" to these internal labels, as they are not user-facing and must remain stable for formula resolution to work.
Opw-4826749
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#212777
@csan-odoo @oco-odoo this PR targets master and is the last of the forward-port chain containing:
- odoo/odoo#215277
- odoo/odoo#215255
To merge the full chain, use
@robodoo r+
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
@csan-odoo @oco-odoo ci/runbot failed on this forward-port PR
@robodoo r+
@oco-odoo you may want to rebuild or fix this PR as it has failed CI.
Freeze happened while this was being merged to master ; manual forward-port for 18.4 is here https://github.com/odoo/odoo/pull/215600
