-
Notifications
You must be signed in to change notification settings - Fork 69
[FIX] pivot: Ensure computed measure range adaptation #7534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
df1d0ec to
7efa1f5
Compare
Currently, ODOO pivots computed measures are not properly updated upon sheet structure modification. To be precise, their definition, which is stored in the core plugin `PivotCorePlugin` is properly updated but the runtime definition, stored in `PivotUIPlugin`, is not. This occurs because the mecanism to invalidate the runtime definition explicitely ignores the ODOO pivots. histoically, this was set up to avoid useless reloading of ODOO pivots which could end up making server calls but this logic is properly handled in the function `onDefinitionChange`. We can see that in the case of spreadsheet pivots, we already notify all plugins of such a change, but by "pure accident", as we dispatch an "UPDATE_PIVOT" command at every range adaptation, regardless of whether it was necessary or not. This means that the spreadsheet pivots beneficiated of two mecanisms to update their runtime (in core, an UPDATE_PIVOT, and the `invalidateEvaluationCommands` mecanism) which means that invalidation work was done two times. The investigation also led to the discovery of a missing check on the command "ADD_PIVOT" which has been reported in https://www.odoo.com/odoo/2328/tasks/5360591 We also noted that there is a double handling of commands between the handling of `invalidateEvaluationCommands` and the specific command handlers in `PivotUIPlugin`. We could clean this up in master. Note that additional tests regarding the Odoo pivots will be added in Odoo repository to ensure the validity of the fix. Task: 5358213
7efa1f5 to
9c32b21
Compare
LucasLefevre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
robodoo r+
| handle(cmd: Command) { | ||
| if (invalidateEvaluationCommands.has(cmd.type)) { | ||
| for (const pivotId of this.getters.getPivotIds()) { | ||
| if (!pivotRegistry.get(this.getters.getPivotCoreDefinition(pivotId).type).externalData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, there's no bug in o-spreadsheet (all tests in this PR are ✔️ in without the diff in the code), but this is this line which prevents from updating odoo pivots ? and also the deepcopy
But then, are the tests introduced/changed here useful ?
|
@rrahir @LucasLefevre because this PR has multiple commits, I need to know how to merge it:
|
|
Ah non, je voulais pas r+ 😅 |
|
robodoo r- @LucasLefevre I tried a first implementatioon which ended up breaking the evaluation (on undo/redo) and all the tests passed, I caught it by testing this morning in Odoo so I added a bit of coverage. |
LucasLefevre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
robodoo r+
|
robodoo rebase-ff |
|
Merge method set to rebase and fast-forward. |
Task: 5358213 Part-of: #7534 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
Currently, ODOO pivots computed measures are not properly updated upon sheet structure modification. To be precise, their definition, which is stored in the core plugin `PivotCorePlugin` is properly updated but the runtime definition, stored in `PivotUIPlugin`, is not. This occurs because the mecanism to invalidate the runtime definition explicitely ignores the ODOO pivots. histoically, this was set up to avoid useless reloading of ODOO pivots which could end up making server calls but this logic is properly handled in the function `onDefinitionChange`. We can see that in the case of spreadsheet pivots, we already notify all plugins of such a change, but by "pure accident", as we dispatch an "UPDATE_PIVOT" command at every range adaptation, regardless of whether it was necessary or not. This means that the spreadsheet pivots beneficiated of two mecanisms to update their runtime (in core, an UPDATE_PIVOT, and the `invalidateEvaluationCommands` mecanism) which means that invalidation work was done two times. The investigation also led to the discovery of a missing check on the command "ADD_PIVOT" which has been reported in https://www.odoo.com/odoo/2328/tasks/5360591 We also noted that there is a double handling of commands between the handling of `invalidateEvaluationCommands` and the specific command handlers in `PivotUIPlugin`. We could clean this up in master. Note that additional tests regarding the Odoo pivots will be added in Odoo repository to ensure the validity of the fix. closes #7534 Task: 5358213 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>

Description:
Currently, ODOO pivots computed measures are not properly updated upon
sheet structure modification. To be precise, their definition, which is
stored in the core plugin
PivotCorePluginis properly updated but theruntime definition, stored in
PivotUIPlugin, is not.This occurs because the mecanism to invalidate the runtime definition
explicitely ignores the ODOO pivots. histoically, this was set up to
avoid useless reloading of ODOO pivots which could end up making server
calls but this logic is properly handled in the function
onDefinitionChange.We can see that in the case of spreadsheet pivots, we already
notify all plugins of such a change, but by "pure accident", as we
dispatch an "UPDATE_PIVOT" command at every range adaptation, regardless
of whether it was necessary or not. This means that the spreadsheet
pivots beneficiated of two mecanisms to update their runtime (in core,
an UPDATE_PIVOT, and the
invalidateEvaluationCommandsmecanism) whichmeans that invalidation work was done two times.
The investigation also led to the discovery of a missing check on the
command "ADD_PIVOT" which has been reported in https://www.odoo.com/odoo/2328/tasks/5360591
We also noted that there is a double handling of commands between the
handling of
invalidateEvaluationCommandsand the specific commandhandlers in
PivotUIPlugin. We could clean this up in master.Note that additional tests regarding the Odoo pivots will be added in
Odoo repository to ensure the validity of the fix.
Task: 5358213
review checklist