[FIX] account: reports: translate line codes properly in copied aggregation formulas
Example: Copy the Belgian P&L, try to open the copied report => error message saying some aggregation terms cannot be expanded. If you open the its form view, you can see that line BE_PL_14's balance formula has been translated from this
BE_9906.balance + BE_791.balance - BE_691_2.balance + BE_794.balance - BE_694_6.balance
to this on the copy:
BE_9906_COPY.balance + BE_791_COPY.balance - BE_691_2_COPY.balance + BE_794.balance - BE_694_6.balance
This is buggy ; BE_794.balance and BE_694_6.balance should be BE_794_COPY.balance - BE_694_6_COPY.balance, in order for them to match the other lines of the copied report properly.
This bug touches other reports more generally. It was due to the fact we replaced the codes in aggregations while we were copying the lines, and not after copying all the lines. Because of that, lines that were referrenced by an aggregation expression belonging to a line coming before them in sequence were not taken into account, as they were not part of the code_mapping dict yet.
OPW-3505592
closes odoo/odoo#135467
Signed-off-by:
John Laterre (jol) <jol@odoo.com>
Loading
Please register or sign in to comment