[MIG] spreadsheet_*: Migration from 18.0 to 19.0#113
[MIG] spreadsheet_*: Migration from 18.0 to 19.0#113
Conversation
…mprove change of kind
Currently translated at 83.1% (69 of 83 strings) Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/nl/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
Currently translated at 100.0% (83 of 83 strings) Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
Currently translated at 100.0% (83 of 83 strings) Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/it/
commands Steps: 1. Open spreadsheet 2. Press command Ctrl + Z 3. F5 (refresh browse) An error occurred: Operation undefined not found Because missing key `undoneRevisionId` / `redoneRevisionId` in revisions data Solutions: Save all spreadsheet message in commands field
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/
Currently translated at 100.0% (83 of 83 strings) Translation: spreadsheet-16.0/spreadsheet-16.0-spreadsheet_oca Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca/it/
- Remove loadSpreadsheetDependencies import and call (Chart.js is now auto-included in spreadsheet.o_spreadsheet bundle via manifest) - Remove "version": 1 from empty spreadsheet data to match upstream Odoo 19.0 spreadsheet.mixin behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove category_id field from res.groups records (field removed in Odoo 19, replaced by privilege_id on res.groups.privilege) - Update domain rules: user.groups_id → user.group_ids (field renamed in Odoo 19) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- ir.ui.menu: groups_id → group_ids (field renamed in Odoo 19) - _sql_constraints list → models.Constraint() (new format in Odoo 19) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The 'users' field was removed from res.groups in Odoo 19. Admin users get the group through implied_ids chain instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In Odoo 19, o-spreadsheet core already registers "file" and "settings" in topbarMenuRegistry. Calling .add() with an existing key throws "file is already present in this registry!". Remove the duplicate registrations, keep only OCA-specific children (filters, save, download). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In Odoo 19, the "New" button's parent changed from a DOM element to a <t t-set-slot="control-panel-create-button"> OWL slot. The old xpath targeting the parent caused the button to render outside the control panel. Updated xpath to target the button directly within the slot. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In Odoo 19, core spreadsheet registers chart subtypes and side panels that OCA also registers. Registry.add() throws on duplicate keys. Use try/catch with fallback to replace() for all registry additions to safely handle both fresh installs and coexistence with core. Affected registries: chartSubtypeRegistry, chartSidePanelComponentRegistry, sidePanelRegistry, pivotSidePanelRegistry. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Since category_id was removed from res.groups in Odoo 19, the spreadsheet groups were not visible in Settings and not automatically assigned to any user. Fix by adding implied_ids to base.group_user so all internal users get spreadsheet access by default. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the previous implied_ids workaround with the proper Odoo 19 privilege system: - Create res.groups.privilege record linked to ir.module.category - Link both User and Manager groups via privilege_id This makes the groups visible in Settings → Users with selectable options: No Access / User / Manager. Admins can control spreadsheet access per user. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In Odoo 19, the web.ListView.Buttons template no longer wraps its buttons inside a <div class="o_list_buttons"> — they are now direct children of the template root. The previous xpath looking for that div fails with "Element cannot be located in element tree" causing an OWL crash when opening the spreadsheet list view. Fix: Position the Upload button after the "New" button (o_list_button_add) instead, which is available at the root level in the new template. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1. spreadsheet_dashboard_purchase_stock_oca: Odoo 19+ stock.picking model
no longer has a 'date' field — renamed to 'scheduled_date'. The purchase
dashboard JSON referenced 'date' causing module install to fail:
field 'date' used in spreadsheet 'Purchase' does not exist
on model 'stock.picking'
Updated list columns, orderBy and ODOO.LIST cell references.
2. spreadsheet_oca: prettier formatting for three files that pre-commit
wanted multi-lined — side panel registrations and an xpath attribute.
No functional change, purely style.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fixes reported by OCA pre-commit CI:
1. Prettier (JSON + JS + XML):
- purchase_dashboard.json reformatted with compact arrays where they fit
within printWidth, plus trailing newline.
- filter.esm.js: sidePanelRegistry.add EditFilterPanel multi-lined.
2. Pylint-odoo W8161 (prefer-env-translation):
Replace `_()` with `self.env._()` which is the new recommended pattern
for translation in Odoo 19+ (closes over env context automatically).
- spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py: 2 sites
- spreadsheet_oca/models/spreadsheet_abstract.py: 1 site
- spreadsheet_oca/models/spreadsheet_spreadsheet.py: 1 site
Removed unused `_` imports.
3. Pylint-odoo E8148 (inheritable-method-lambda):
Wrap `default=_get_default_color` with a lambda to keep the method
inheritable: `default=lambda self: self._get_default_color()`.
- spreadsheet_oca/models/spreadsheet_spreadsheet_tag.py
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
To ReproduceAffected versions: Odoo 19.0 with spreadsheet_oca module (19.0 branch) Steps to reproduce the behavior:
Expected behavior Actual behavior
Additional context
|
Fixes runtime error "Chart with id undefined does not exist" when interacting with chart panels in Odoo 19.0. Root cause: o-spreadsheet 19.0 renamed the identifying prop on ChartTypePicker and all config panels (GenericChartConfigPanel, LineConfigPanel, BarConfigPanel, ScorecardChartConfigPanel, GaugeChartConfigPanel) from `figureId` to `chartId`. The previous patch still read `this.props.figureId`, which is undefined in 19.0, causing getChartDefinition(undefined) to throw. Changes in chart_panel.esm.js: - Rename figureId variable & prop reference to chartId throughout - Rename helper getFigureDefinition → getChartDefinition for clarity - Add defensive early return when chartId is falsy in onTypeChange and filterCategoriesChartType to avoid crashes during initial mount Changes in chart_panels.esm.js: - Rename this.props.figureId to this.props.chartId in menuId getter and both LINK_ODOO_MENU_TO_CHART dispatch calls Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
thanks for the report. Commit fixes it. Root cause: o-spreadsheet 19.0 renamed the chart identifier prop from Fix:
References:
Please pull and retest. |
… API
Fixes OWL lifecycle crash when opening any chart side panel:
TypeError: this.env.model.getters.getChartOdooMenu is not a function
at get menuId (chart_panels.esm.js:41)
Discovered after the earlier figureId → chartId fix (commit b777caa /
2e17e44) let the panel render far enough to hit this second API change.
Root cause: Odoo 19+ / saas-19.2 restructured chart-link storage.
Getter rename:
env.model.getters.getChartOdooMenu(chartId) # returns menu obj
→ env.model.getters.getChartOdooLink(chartId) # returns OdooLink | undefined
Command rename:
dispatch("LINK_ODOO_MENU_TO_CHART", {chartId, odooMenuId})
→ dispatch("UPDATE_ODOO_LINK_TO_CHART", {chartId, odooLink})
OdooLink shape:
{ type: "odooMenu", odooMenuId: number | string }
| { type: "dataSource", dataSourceType, dataSourceCoreId }
| undefined # for unlink
Changes:
- `menuId` getter: resolve via getChartOdooLink, check link.type ==
"odooMenu", then getIrMenu(link.odooMenuId). Returns false if no link
or link is a dataSource rather than a menu.
- `updateMenu(menuId)`: dispatch UPDATE_ODOO_LINK_TO_CHART with proper
typed odooLink payload (or undefined to unlink).
Refs:
- Odoo saas-19.2 source: addons/spreadsheet/static/src/chart/plugins/chart_odoo_link_plugin.js
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Migrate all four OCA spreadsheet modules from 18.0 to 19.0, including
compatibility fixes discovered during CI validation and runtime testing.
The runtime pass uncovered two additional chart-side-panel crashes in
Odoo 19's o-spreadsheet; the fixes are included in this PR.
Modules migrated
spreadsheet_oca(18.0.1.3.0 → 19.0.1.0.0)spreadsheet_dashboard_oca(18.0.1.1.0 → 19.0.1.0.0)spreadsheet_dashboard_purchase_oca(18.0.1.0.0 → 19.0.1.0.0)spreadsheet_dashboard_purchase_stock_oca(18.0.1.0.0 → 19.0.1.0.0)Python changes
Remove
"version": 1from empty spreadsheet data inspreadsheet_abstract.pyto match upstreamspreadsheet.mixinbehavior in Odoo 19Remove
loadSpreadsheetDependencies()import and call — Chart.js is now auto-included inspreadsheet.o_spreadsheetbundle via Odoo 19 manifestMigrate
_sql_constraintslist format tomodels.Constraint()class attribute inspreadsheet_spreadsheet_tag.pyMigrate
_()translations toself.env._()in all model files — the new Odoo 19 convention that closes over env context automatically (fixes pylint-odoo W8161prefer-env-translation):spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py(2 call sites)spreadsheet_oca/models/spreadsheet_abstract.py(1 call site)spreadsheet_oca/models/spreadsheet_spreadsheet.py(1 call site)from odoo import _importsWrap
default=_get_default_colorwith a lambda inspreadsheet_spreadsheet_tag.pyso the default method remains inheritable in subclasses (fixes pylint-odoo E8148inheritable-method-lambda):JavaScript changes
Core asset & registry migration
@spreadsheet/assets_backend/helpers→@spreadsheet/helpers/helpers(file relocated in Odoo 19)topbarMenuRegistry.add("file")— already registered by o-spreadsheet core library in Odoo 19topbarMenuRegistry.addChild("settings")— already registered by coretry/catchwith.replace()fallback) forchartSubtypeRegistry,chartSidePanelComponentRegistry,sidePanelRegistry, andpivotSidePanelRegistryto prevent "already present in this registry!" crashesListView template changes
web.ListView.Buttonstemplate no longer wraps its children in a<div class="o_list_buttons">— buttons are direct children of the template root. The old xpath caused an OWL crash (Element cannot be located in element tree) when opening the spreadsheet list view. Target theo_list_button_addbutton instead.control-panel-create-buttonslot directly instead of parent element (template structure changed in 19)Chart side-panel API migration
Discovered at runtime after the module initially installed cleanly: clicking
any chart produced a JS crash that made the whole chart feature unusable.
Two coordinated o-spreadsheet API changes required fixes:
Component prop rename (
figureId→chartId) — commit2e17e44o-spreadsheet 19.0 renamed the identifying prop on every chart-related
side-panel component:
ChartTypePickerfigureIdchartIdGenericChartConfigPanelfigureIdchartIdLineConfigPanelfigureIdchartIdBarConfigPanelfigureIdchartIdScorecardChartConfigPanelfigureIdchartIdGaugeChartConfigPanelfigureIdchartIdNew props contract:
Our patches still read
this.props.figureId→undefined→getChartDefinition(undefined)throwsChart with id undefined does not exist.Fix: rename
figureId→chartIdinchart_panel.esm.jsandchart_panels.esm.js; rename internal helpergetFigureDefinition→getChartDefinition; add defensive early-return for a briefly undefinedchartIdduring initial component mount.Chart-menu link API rename — commit
4f51879o-spreadsheet 19.0 restructured the chart → Odoo-menu link into a generic
typed-link API:
OdooLinkshape (fromaddons/spreadsheet/static/src/chart/plugins/chart_odoo_link_plugin.js):Symptom before this fix: OWL lifecycle crash on any chart panel render —
TypeError: this.env.model.getters.getChartOdooMenu is not a functionatmenuIdgetter. Fix: resolve viagetChartOdooLinkwith type guard; dispatchUPDATE_ODOO_LINK_TO_CHARTwith the typed payload; passodooLink: undefinedto unlink.XML / Security changes
category_idfield fromres.groupsrecords insecurity.xml(field removed in Odoo 19)usersfield fromres.groupsrecords insecurity.xml(field renamed touser_idsin Odoo 19)res.groups.privilegerecord linked toir.module.categoryso spreadsheet groups appear in user settings with selectable options (No Access / User / Manager)groups_id→group_idsonir.ui.menurecords inspreadsheet_spreadsheet.xml(field renamed in Odoo 19)user.groups_id→user.group_idsin all domain rules insecurity.xml(field renamed in Odoo 19)Dashboard data fixes
spreadsheet_dashboard_purchase_stock_oca/data/files/purchase_dashboard.json: replacedatewithscheduled_datefor thestock.pickinglist. Thedatefield was renamed toscheduled_dateonstock.pickingin Odoo 19. Affected:columnsdefinitionorderByclauseODOO.LIST(3, *, "date")cell references on the Dashboard sheetWithout this fix module install fails with:
Formatting / tooling
purchase_dashboard.json(compact arrays withinprintWidth, trailing newline) to pass OCA pre-commitsidePanelRegistry.add()/.replace()object literals infilter.esm.jsandfilter_panel_datasources.esm.jslist_controller.xmlNo changes required
web.assets_backend,web.assets_backend_lazy) remain valid in Odoo 19.0invisible=and<list>Testing performed
All items below were manually tested on Odoo 19.0:
stock.pickingTransfers list (previously crashed because ofdatefield)Chart with id undefinederrorgetChartOdooLinkreturnsundefinedReferences
chart_type_picker.ts:static props = { chartId: String, chartPanelStore: Object }common.ts:ChartSidePanelPropsObjectdeclareschartId: String+updateChart,canUpdateChart,definitionchart_odoo_link_plugin.js: defines thegetChartOdooLinkgetter,UPDATE_ODOO_LINK_TO_CHARTcommand, andOdooLinktype (odooMenu|dataSource)CI status
All 7 checks pass on the latest push: