Skip to content

Conversation

@odoowired
Copy link
Contributor

No description provided.

@odoowired odoowired mentioned this pull request Jul 30, 2025
2 tasks
@odoowired odoowired changed the title [MIG] spreadsheet_oca: Migration to 18.0 [18.0][MIG] spreadsheet_oca: Migration to 18.0 Jul 30, 2025
@odoowired odoowired force-pushed the 18.0-mig-spreadsheet_oca branch from 4ba6790 to c493841 Compare July 30, 2025 09:33
Copy link
Member

@tarteo tarteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one heck of a module, thanks for your contribution!
I get an error when I go to a pivot view:

image

I'm also missing the "add to spreadsheet" buttons on list views:

image

Comment on lines 217 to 312
spreadsheet_model.dispatch("ADD_PIVOT", {
pivotId: dataSourceId,
definition: pivot_info,
});
const dataSource = spreadsheet_model.getters.getPivotDataSource(dataSourceId);
await dataSource.load();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @odoowired,

When installing your changes, I get an error over here:

UncaughtPromiseError > OwlError

Uncaught Promise > An error occured in the owl lifecycle (see this Error's "cause" property)

Occured on localhost:8069 on 2025-08-20 08:13:15 GMT

OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
    OwlError@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:728:1
    handleError@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:972:101
    handleError@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1619:29
    initiateRender@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1064:19
    async*createComponent/<@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1617:80
    template@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js line 1574 > Function:12:21
    _render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:996:96
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:995:6
    initiateRender@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1065:47
    async*createComponent/<@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1617:80
    template@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js line 1574 > Function:9:27
    _render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:996:96
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:995:6
    initiateRender@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1065:47
    async*createComponent/<@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1617:80
    template@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js line 1574 > Function:14:43
    _render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:996:96
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:995:6
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1073:56
    async*render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1120:33
    setup/this.onActionManagerUpdate@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9933:101
    trigger@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:764:63
    _updateUI@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10046:133
    _executeClientAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10062:181
    async*doAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10077:192
    async*_executeClientAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10062:275
    async*doAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10077:192
    async*doActionButton@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10088:255
    async*execute@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9690:314
    async*executeButtonCallback@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9683:40
    onClickViewButton@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9693:487
    

Caused by: TypeError: can't access property "measures", definition is undefined
    checkDuplicatedMeasureIds@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:8275:63
    allowDispatch@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:8236:347
    checkDispatchAllowedCoreCommand/results<@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:11749:96
    checkDispatchAllowedCoreCommand@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:11749:73
    checkDispatchAllowed@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:11747:73
    dispatch@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:11755:41
    importDataPivot@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:12954:661
    importData@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:12958:84
    setup/<@http://localhost:8069/web/assets/a83aebc/spreadsheet.o_spreadsheet.min.js:12922:1160
    async*initiateRender/<@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1063:80
    initiateRender@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1063:69
    createComponent/<@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1617:80
    template@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js line 1574 > Function:12:21
    _render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:996:96
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:995:6
    initiateRender@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1065:47
    async*createComponent/<@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1617:80
    template@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js line 1574 > Function:9:27
    _render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:996:96
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:995:6
    initiateRender@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1065:47
    async*createComponent/<@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1617:80
    template@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js line 1574 > Function:14:43
    _render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:996:96
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:995:6
    render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1073:56
    async*render@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:1120:33
    setup/this.onActionManagerUpdate@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9933:101
    trigger@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:764:63
    _updateUI@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10046:133
    _executeClientAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10062:181
    async*doAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10077:192
    async*_executeClientAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10062:275
    async*doAction@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10077:192
    async*doActionButton@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:10088:255
    async*execute@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9690:314
    async*executeButtonCallback@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9683:40
    onClickViewButton@http://localhost:8069/web/assets/2e8099d/web.assets_web.min.js:9693:487

By looking deeper into the code, I think "ADD_PIVOT" need the complete pivot object, which is why this error is triggered.

And I'm not sure the line after is still valid, i.e. I don't find any getPivotDataSource method anymore in Odoo 18

To reproduce the error, I just tried to insert a pivot view with some measures in a dashboard and the error pops up.

PS : I locally rollbacked some of your changes to match previous formatting to better see the real changes. I can share that to you if you want to merge it that way. I don't know what is the standard over that

Comment on lines 39 to 43
var message = _l("Add to spreadsheet");
if (this.containsDuplicatedGroupBys()) {
message = _l("Duplicated groupbys in pivot are not supprted");
} else if (this.isComparingInfo()) {
message = _l("Comparisons in pivot are not supprted");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix @tarteo error, you can do this

Suggested change
var message = _l("Add to spreadsheet");
if (this.containsDuplicatedGroupBys()) {
message = _l("Duplicated groupbys in pivot are not supprted");
} else if (this.isComparingInfo()) {
message = _l("Comparisons in pivot are not supprted");
var message = _t("Add to spreadsheet");
if (this.containsDuplicatedGroupBys()) {
message = _t("Duplicated groupbys in pivot are not supprted");
} else if (this.isComparingInfo()) {
message = _t("Comparisons in pivot are not supprted");

After updating the import

import {_t} from "@web/core/l10n/translation";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheToto42 Thanks, I will add it now :)

etobella and others added 24 commits September 16, 2025 09:11
With this change we are adding an extra layer of security. Without it, any user was able to sniff how all happened using something like:

    const any_spreadsheet_id = 1234;
    const channel = "spreadsheet_oca;spreadsheet.spreadsheet;" + any_spreadsheet_id;
    bus_service.addChannel(channel);
    bus_service.addEventListener("spreadsheet_oca", (message) => /* every revision arrives here */

With the change, we verify the access to the model with a similar logic to `web_editor` fields
@odoowired odoowired force-pushed the 18.0-mig-spreadsheet_oca branch from c493841 to da03df0 Compare September 16, 2025 07:11
@chrisandrewmann
Copy link
Contributor

chrisandrewmann commented Sep 16, 2025

Hi @odoowired, thanks for your contribution to this.
I worked on the V17 migration which was a challenge and this one seems even greater so imagine it will take a few people to achieve.

After testing your PR I also observed similar issues and have a partially working prototype that fixes some of them.
However I struggled to fully resolve all.
As there are so many changes, would you like me to send you my code so you can look through it and incorporate into your PR?
I can give you the Git diff here:
diff.patch

Fixed

  • Adding lists datasource to spreadsheets
  • Partial: Adding pivots datasource to spreadsheets - There is a problem with the date dimension which I can't quite solve
  • Inserting pivot and list from data sources panel
  • Editing pivot and list from data sources panel

Issues remaining

  • Charts from datasets can be inserted but cannot be edited - Crash when opening properties
  • Fixed: Pivots have issue when using date dimensions based on month for some reason, year / day all work ok
  • Undo / Redo logic not working: Since V17 there seems a disconnect between the revisions history and the GUI causing this to fail. Even keyboard shortcuts CTRL + Z don't work
  • Global filters dont work, saving has no effect

@odoowired
Copy link
Contributor Author

@chrisandrewmann Thanks, I will include them. are you for some luck in the OCA days today or tomorrow?

@chrisandrewmann
Copy link
Contributor

@chrisandrewmann Thanks, I will include them. are you for some luck in the OCA days today or tomorrow?

@odoowired I've fixed the Pivot date group-by issue.
Let me know once you've added my other changes, or I can give you a brand-new git diff instead.

@gjlong68
Copy link

image

@chrisandrewmann
Copy link
Contributor

@odoowired @tarteo Don't worry about doing anything with this. I've been busy over the last few days and have a fully working prototype with all previous issues solved, and a few new improvements added.
Hope to do a PR that supercedes this one soon.

Also have a version of spreadsheet_dashboard_oca which adds the ability to "Add to Dashboard" from the spreadsheet itself.

@pedrobaeza
Copy link
Member

Please publish it, as we are waiting for a fully functional one.

@odoowired odoowired force-pushed the 18.0-mig-spreadsheet_oca branch from da03df0 to 6e24fe4 Compare September 23, 2025 06:58
@odoowired odoowired force-pushed the 18.0-mig-spreadsheet_oca branch from 6e24fe4 to b123d41 Compare September 23, 2025 07:07
@odoowired
Copy link
Contributor Author

@chrisandrewmann Got some delays trying to fix on page refresh. But looks like everything is working. Let me know if you have other fixes that I could add here

@chrisandrewmann
Copy link
Contributor

chrisandrewmann commented Sep 23, 2025

@chrisandrewmann Got some delays trying to fix on page refresh. But looks like everything is working. Let me know if you have other fixes that I could add here

There's too many changes to do it that way. I'll have to do a new PR and you can compare them.
I'll list out all the fixes in the description and refer to this one.
Also I've forward ported any V17 fixes that have been merged since.

@chrisandrewmann
Copy link
Contributor

New PR submitted #72
@pedrobaeza @odoowired @tarteo

@chrisandrewmann
Copy link
Contributor

chrisandrewmann commented Oct 9, 2025

@pedrobaeza @etobella This PR can be closed now since #72 has been merged please?

@pedrobaeza pedrobaeza closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.