Skip to content

[19.0][MIG] spreadsheet_oca: Migration to 19#109

Closed
mpiko wants to merge 239 commits into
OCA:19.0from
mpiko:19.0-mig-spreadsheet_oca2
Closed

[19.0][MIG] spreadsheet_oca: Migration to 19#109
mpiko wants to merge 239 commits into
OCA:19.0from
mpiko:19.0-mig-spreadsheet_oca2

Conversation

@mpiko

@mpiko mpiko commented Mar 28, 2026

Copy link
Copy Markdown

[MIG] spreadsheet_oca, spreadsheet_dashboard_oca: Migration to 19.0

This PR migrates spreadsheet_oca and spreadsheet_dashboard_oca to Odoo 19.0 Community Edition. All fixes have been verified against a running Odoo 19.0 instance.

Relates to #73


Python/XML changes

security/security.xml

  • Removed category_id and users fields from res.groups records — both removed in Odoo 19
  • Renamed groups_idgroup_ids in ir.rule domain expressions

views/spreadsheet_spreadsheet.xml

  • Renamed groups_idgroup_ids on ir.ui.menu record

models/spreadsheet_abstract.py

  • Updated _t() to self.env._() per Odoo 19 convention

models/spreadsheet_spreadsheet.py

  • Updated _t() to self.env._() per Odoo 19 convention

models/spreadsheet_spreadsheet_tag.py

  • Fixed inheritable-method-lambda: default=_get_default_colordefault=lambda self: self._get_default_color()

spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py

  • Updated _t() to self.env._() per Odoo 19 convention

JavaScript changes

bundle/filter.esm.js

  • globalFiltersFieldMatchers removed from global_filters_core_plugin — replaced by globalFieldMatchingRegistry from @spreadsheet/global_filters/helpers with updated method signatures (all methods now take getters as first argument)
  • RELATIVE_DATE_RANGE_TYPES removed from @spreadsheet/helpers/constants — replaced by RELATIVE_PERIODS from @spreadsheet/global_filters/helpers
  • Removed duplicate topbarMenuRegistry.add("file") and addChild("settings") registrations already present in Odoo 19

bundle/spreadsheet_renderer.esm.js

  • @spreadsheet/assets_backend/helpers and loadSpreadsheetDependencies removed in Odoo 19 — replaced with loadBundle("spreadsheet.o_spreadsheet") from @web/core/assets

bundle/spreadsheet_action.esm.js

  • actionRegistry.add("action_spreadsheet_oca") requires { force: true } as the action key is first registered by the lazy loader in web.assets_backend

bundle/odoo_panels.esm.js

  • All chartSubtypeRegistry.add(...) entries removed — these are now registered by the Odoo 19 community spreadsheet module and caused a registry conflict

bundle/filter_panel_datasources.esm.js

  • Added { force: true } to pivotSidePanelRegistry.add("ODOO") — already registered by Odoo 19 community module
  • Fixed getTableStructure() renamed to getCollapsedTableStructure() (static) and getExpandedTableStructure() (dynamic)

etobella and others added 30 commits March 29, 2026 06:16
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
@pedrobaeza pedrobaeza changed the title 19.0 mig spreadsheet oca2 [19.0][MIG] spreadsheet_oca: Migration to 19 Mar 31, 2026
@mpiko

mpiko commented Apr 13, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback. I've addressed the issue with the pivot and data source panels. The root cause was getFormattedGroupBy() and sortedColumn.groupBy which no longer exist in Odoo 19 — the sortedColumn structure now only contains domain, order and measure. I've updated filter_panel_datasources.esm.js accordingly and tested locally — the pivot side panel and Data menu both open correctly without errors.

return this.columns
.filter(
(col) =>
col.type === "field" &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add fields[col.name] && as in #88.

@pedrobaeza

Copy link
Copy Markdown
Member

This one mixes 2 modules. Please isolate only spreadsheet_oca following migration guide https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-19.0

@arielbarreiros96

Copy link
Copy Markdown

@mpiko tested on runboat and getting this error when trying to open the "Spreadsheets" menu. Resume of the error:

... Caused by: Error: Element '<xpath expr="//div[hasclass('o_list_buttons')]" position="inside"> <SpreadsheetFileUploader> <t t-set-slot="toggler"> <button type="button" class="btn btn-secondary o_button_upload_spreadsheet"> Upload </button> </t> </SpreadsheetFileUploader> </xpath>' cannot be located in element tree Error: Element '<xpath expr="//div[hasclass('o_list_buttons')]" position="inside"> <SpreadsheetFileUploader> <t t-set-slot="toggler"> <button type="button" class="btn btn-secondary o_button_upload_spreadsheet"> Upload </button> </t> </SpreadsheetFileUploader> </xpath>' cannot be located in element tree ...

@OCA-git-bot OCA-git-bot added mod:spreadsheet_dashboard_oca Module spreadsheet_dashboard_oca mod:spreadsheet_oca Module spreadsheet_oca series:19.0 labels Jul 23, 2026
@mpiko

mpiko commented Jul 23, 2026

Copy link
Copy Markdown
Author

The list view crash reported here (o_list_buttons xpath target not found on web.ListView.Buttons) has been fixed in the latest commit (370c4dc).

Root cause: web.ListView.Buttons is now an empty template in 19.0 core (list buttons are rendered via a slot call, t-call="{{ props.buttonTemplate }}", with no wrapping div.o_list_buttons), so the module's xpath-based inheritance had nothing to attach to. Fixed by having spreadsheet_oca.ListView.Buttons render its content directly rather than inheriting from the now-empty core template.

While testing, two related issues found and are fixed in the same commit:

A template name collision (spreadsheet_oca.ListView.Buttons was defined twice in the module, for two unrelated purposes).
security.xml used fields (category_id on res.groups) that no longer exist in 19.0, and one ir.rule domain checked only direct group membership rather than the transitive closure via res.users.all_group_ids, which meant the "Import" mode selector could show no options for users with an inherited (Manager) rather than direct (User) group assignment.

Verified on runboat (build for 370c4dc): Spreadsheets menu loads without error, Upload button renders and functions, "Add to spreadsheet" still works correctly on unrelated list views, and the Import Pivot wizard completes an actual import end to end with all group privilege levels.

@arielbarreiros96 would appreciate a re-test on your end to confirm.

@mpiko
mpiko requested a review from jans23 July 23, 2026 01:18
@chrisandrewmann

Copy link
Copy Markdown
Contributor

Thanks @mpiko i've just tested and lists seem to be working much better.
Also the spreadsheet menus are working ok for me.

I tested the pivots however and there is still a lot to do there.
Also I noticed your 19.0 branch may be behind 18.0 as it's lacking some of the most recent PRs including:

Steps below to reproduce adding pivot error:

  1. Go to Invoices > Reporting > Pivot view (or any module with a pivot)
  2. Click the spreadsheet icon, choose "Create Spreadsheet"
  3. Error thrown below
Odoo Client Error

UncaughtPromiseError
Uncaught Promise > Component is destroyed

Occured on oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org on 2026-07-23 09:01:51 GMT

Error: Component is destroyed
    at Object.original (http://oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org/web/assets/a0a3f8c/web.assets_web.min.js:4757:183)
    at Object.fn (http://oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org/web/assets/a0a3f8c/web.assets_web.min.js:4757:99)
    at ORM.call (http://oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org/web/assets/a0a3f8c/web.assets_web.min.js:4757:362)
    at SpreadsheetTransportService.sendMessage (http://oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org/web/assets/dc9a01d/spreadsheet.o_spreadsheet.min.js:13322:60)
    at Session.sendToTransport (http://oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org/web/assets/dc9a01d/spreadsheet.o_spreadsheet.min.js:9248:61)
    at Session._move (http://oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org/web/assets/dc9a01d/spreadsheet.o_spreadsheet.min.js:9239:336)
    at later (http://oca-spreadsheet-19-0-pr109-370c4dc89949.runboat.odoo-community.org/web/assets/dc9a01d/spreadsheet.o_spreadsheet.min.js:2680:189)

@mpiko

mpiko commented Jul 23, 2026

Copy link
Copy Markdown
Author

Pushed a second fix (2693060): the pivot-to-spreadsheet crash from your last comment (ds.getTableStructure is not a function). That method was split into getCollapsedTableStructure/getExpandedTableStructure upstream in o-spreadsheet; this module's own PivotPanelDisplay already uses the split correctly elsewhere, only importDataPivot was missed during the migration. Fixed by matching that existing convention (getExpandedTableStructure for dynamic mode). Verified on mint-dev: pivot import from Invoices Analysis now completes and produces the correct table.

@chrisandrewmann

chrisandrewmann commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Pushed a second fix (2693060): the pivot-to-spreadsheet crash from your last comment (ds.getTableStructure is not a function). That method was split into getCollapsedTableStructure/getExpandedTableStructure upstream in o-spreadsheet; this module's own PivotPanelDisplay already uses the split correctly elsewhere, only importDataPivot was missed during the migration. Fixed by matching that existing convention (getExpandedTableStructure for dynamic mode). Verified on mint-dev: pivot import from Invoices Analysis now completes and produces the correct table.

Thanks, pivots seem to work well for me now.

I'd ask if you could check your 19.0 branch incorporates the PRs that were merged for 18.0 since created.
It looks like those feature PRs I mentioned were included, but somehow they've been lost in your branch? Worth checking what else may have been overwritten / lost.
#92 (Updated to modern pivot panel)
#94 (Fix to duplicated graph types)
#84 (Add kanban views)

Update: Seems like you need rebase on latest 18.0 and reapply your changes on-top.

@chrisandrewmann

Copy link
Copy Markdown
Contributor

@mpiko I have my own branch which is a rough prototype of spreadsheet_oca working in 19.0, which may be helpful. Although its much older than yours.

Couple of issues that mine solved, which I observed are not right on your branch:

  1. Button to add graph to spreadsheet does nothing currently. Not sure why
  2. "Add to list" button on listview is positioned wrongly.
    This was my code for it if it helps (static/src/spreadsheet/list_controller.xml
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
    <t
        t-name="spreadsheet_oca.ListView.Buttons"
        t-inherit="web.ListView.Buttons"
        t-inherit-mode="extension"
    >
        <xpath expr="." position="inside">
            <t t-if="!env.isSmall">
                <button
                    type="button"
                    class="btn btn-secondary o_list_export_spreadsheet"
                    data-tooltip="Add to spreadsheet"
                    aria-label="Add to spreadesheet"
                    t-on-click="(ev) => this.onSpreadsheetButtonClicked(ev)"
                ><i class="fa fa-table"></i></button>
            </t>
        </xpath>
    </t>
</templates>

@chrisandrewmann

chrisandrewmann commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@mpiko I've run a check through Claude and it gave this as the reason for the regressions:

Both commits are contaminated:

3f651a7 ("Migration to 19.0"): strips 160 lines from views/spreadsheet_spreadsheet.xml — that's PR84's kanban/tags/menus being deleted, disguised as migration work.
31c738d ("fix sortedColumn.groupBy"): 3026 deletions, re-adds pivot_table.esm.js and dynamic_generators.esm.js (files 18.0 deliberately removed), and rewrites chart_panel.esm.js — reverting PR94.

@mpiko

mpiko commented Jul 23, 2026

Copy link
Copy Markdown
Author

Pushed two more commits (86b3cd8, feb96f1) addressing the regression you flagged and several related issues found while investigating it.

86b3cd8: restored functionality lost in earlier migration commits. Confirmed via git show on the flagged commits (3f651a7, 31c738d) that both contained unrelated feature strips alongside genuine migration fixes: the kanban view, tags model, badge image, chatter/activity mixins, and archive support were all removed without technical justification, not because anything in them was actually 19.0-incompatible. Restored all of it: spreadsheet.spreadsheet.tag model, ir.model extension, kanban view, tags menu/action, mail.thread/mail.activity.mixin inheritance (now with mail added to depends explicitly), and the active field with archive ribbon. Kept the one genuine fix from those commits (groups_id -> group_ids rename).

feb96f1: pivot/list/graph insertion and chart type picker fixes:

  • importDataGraph's CREATE_CHART dispatch used a stale argument shape (id/position:{x,y}) from before core's figure/chart command signature split into figureId/chartId/col/row/offset/size. This silently failed validation with no error, which is why "Add to spreadsheet" from a graph view did nothing. Fixed to use the current signature, matching core's own chart-insertion action.
  • importCreateOrReuseSheet computed the next available row when adding to an existing spreadsheet but never actually returned it, both importDataPivot and importDataList always inserted at row 0 regardless, causing "Add to spreadsheet" to silently fail or overlap existing content. Fixed to use the computed row, and extended it to also account for existing chart figures (which don't occupy cells, so the old cell-only scan couldn't see them).
  • The chart type picker exposed core's full set of odoo chart subtypes (including combo, waterfall, sunburst, etc.) that this module has never had configuration support for, selecting several of them threw uncaught errors. Filtered to the three families this module actually supports (bar/line/pie) and fixed type-switching to bypass a core store method that unconditionally throws for any Odoo-chart type change.
  • Removed pivot_table.esm.js and dynamic_generators.esm.js, dead code re-added by 31c738d that nothing in the module references; the former used a legacy this._super() patch pattern that would throw on any dynamic-column pivot.

All of the above verified directly on a live 19.0 instance, not just read from source. @arielbarreiros96, appreciate another look when you have time

@chrisandrewmann

chrisandrewmann commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Thanks @mpiko however as there are still sevearl further issues, I felt it simpler to start a new PR here #122

It also splits spreadsheet_oca from spreadsheet_dashboard_oca, which will be done seperately.
@pedrobaeza @arielbarreiros96

@pedrobaeza

Copy link
Copy Markdown
Member

Yes, each PR should be one module, not several, and if this one doesn't contain latest 18.0 improvements, I think it's better to switch to the other PR.

@pedrobaeza pedrobaeza closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:spreadsheet_dashboard_oca Module spreadsheet_dashboard_oca mod:spreadsheet_oca Module spreadsheet_oca series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.