Skip to content

[fork-CI] [20.0][FIX] spreadsheet_oca: stop the ACL row overriding the sharing rules - #15

Open
dnplkndll wants to merge 100 commits into
20.0from
20.0-fix-spreadsheet_oca-ir-access
Open

dnplkndll wants to merge 100 commits into
20.0from
20.0-fix-spreadsheet_oca-ir-access

Conversation

@dnplkndll

Copy link
Copy Markdown

Fork-only, for CI. Nothing to send upstream: OCA/spreadsheet@20.0 does not contain
spreadsheet_oca at all — the 20.0 MIG is the still-open
OCA/spreadsheet#137, which does not have
this row. 19.0 and 18.0 are unaffected. The defect is ours alone.

What was wrong

20.0 merged ir.model.access + ir.rule into ir.access, where group-bound entries are
OR-ed. Our conversion kept the ACL's empty domain, which is now Domain.TRUE — and a
TRUE member short-circuits the whole OR (odoo/orm/domains.py:630-639):

OR(TRUE, owner, contributor, reader) & AND(company)  ->  TRUE & company

So owner/contributor/reader were dead code and any spreadsheet_oca.group_user could read,
write and delete every spreadsheet in their company.

On 19.0 the same pair was correct — the ACL granted the operation, the six ir.rule
records restricted the rows, composing as AND. Deleting the row restores long-shipped
behaviour; keeping it was the behaviour change.

Why create still works

owner_id is required=True, default=lambda r: r.env.user.id. The model-level pre-check
runs on an empty recordset (models.py:4116), where has_access only asks
not domain.is_false(). The record-level check is the last statement of _create
(:4449), after defaults and the INSERT, so filtered_domain reads the written
owner_id. Both pass.

Also here

owner_id gains copy=False — duplicating someone else's spreadsheet copied their
owner_id, which the owner rule now rejects.

Tests

First tests in this module. They must run as a plain group_user: a TransactionCase is
SUPERUSER_ID, which returns from check_access before any ir.access is read, and admin
is in group_manager — so neither would catch this.

Known, not addressed here

  • views/spreadsheet_spreadsheet.xml exposes owner_id editable with no readonly. A
    group_user who reassigns it now gets an AccessError. Left alone deliberately.
  • On a demo database the demo spreadsheet has no owner_id, so it is owned by root and a
    plain group_user now sees an empty kanban.
  • spreadsheet.oca.revision's ACL (base.group_user,crud, no domain) is a separate
    pre-existing over-grant — any internal user can read/write every revision row. Its own fix.

AI-assisted (Claude Code); every change reviewed, tested, and owned by the author.

etobella and others added 30 commits November 10, 2026 14:57
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
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
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/
Steps to reproduce the problem:

1. Go to a pivot
2. Group by something on the cols or on the rows
3. Create a spreadsheet with that info

The pivot is imported on the initial state
Currently translated at 100.0% (85 of 85 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/
When adding a pivot table to a spreadsheet, it
does not maintain the specified order because the
sortedColumn option is not being completed.

Steps to reproduce the issue:

1. Go to a pivot table
2. Change the default order
3. Add to the spreadsheet

The added table will not have preserved the order.
flotho and others added 27 commits November 10, 2026 14:57
Currently translated at 100.0% (164 of 164 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/it/
…f each one

Before these changes, all existing chart types were displayed in the selector.

With these changes, the table type is taken into account, whether it is inserted from Odoo or from the spreadsheet itself, to determine which chart types are usable and which are not.
Currently translated at 100.0% (160 of 160 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/it/
This commit fixes the problem reported in this issue: OCA#96

Before these changes, the domain was taking the processed domain value, so it was using the value for the logged-in user. For example, if the uid variable was used, it was replaced with the user's ID and thus passed that way to the spreadsheet domains.

After these changes, the domain sent to the spreadsheet is the unprocessed domain, so the variables are preserved and remain fully usable.
Steps to reproduce the error:
1. Set debug=assets
2. Add a chart to spreadsheet
3. In "Link to Odoo menu" section select a record

An error will be thrown
Currently translated at 100.0% (161 of 161 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/it/
When a pivot has a sort defined and the data of the pivot is opened an error is thrown because the data is not processed correctly.

By doing this changes, we adapt the code to the new way of process the pivot data and the error does not being thrown anymore.
With this changes we are adding:
1. Include children records when it is possible
2. Add default values for the filter
3. If the model is for users allow set the current user by default
4. Allow to restrict values with a domain
Currently translated at 100.0% (166 of 166 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/it/
Currently translated at 59.0% (98 of 166 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/es/
Currently translated at 100.0% (166 of 166 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/es/
Currently translated at 100.0% (166 of 166 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/es/
Currently translated at 100.0% (166 of 166 strings)

Translation: spreadsheet-18.0/spreadsheet-18.0-spreadsheet_oca
Translate-URL: https://translation.odoo-community.org/projects/spreadsheet-18-0/spreadsheet-18-0-spreadsheet_oca/fr/
…lPanel

SpreadsheetControlPanel extends ControlPanel but overrides
its static components property, losing Dropdown and
DropdownItem that the parent template uses.

This causes "Cannot find the definition of component
Dropdown" when opening a spreadsheet from certain
navigation paths (e.g. from a form view).

Fix: spread parent components before adding custom ones.
Signed-off-by: Don Kendall <dkendall@ledoweb.com>
Assisted-by: Claude Opus 5
* odoo/http.py became the package odoo/http/, which re-exports only a subset: content_disposition now comes from odoo.http.stream
* security/ir.model.access.csv and the six ir.rule records fold into a single security/ir.access.csv; the rules become rows carrying a domain, with per-operation scope (reader r, contributor ru, the rest crud)
* ir.model.access is gone, so the websocket access check uses the record-level has_access()
* 20.0 binary fields hold a BinaryValue, whose .content is the decoded bytes -- where 19.0's field value was the base64 itself. So the base64 hop around spreadsheet_binary_data goes away entirely rather than moving: the field now stores the JSON, read back with BinaryValue.decode and written as BinaryBytes(json...). Keeping the hop round-trips for records this module creates but cannot read one migrated from 19.0, whose stored content is the plain JSON -- every spreadsheet and dashboard carried over fails to open with a UnicodeDecodeError from the double decode
* ir.attachment.datas is gone in 20.0 (a write to it is silently dropped), so the xlsx import reads attachment.raw
* the front end is ported to Owl 3 with odoo/upgrade_code --script owl3-migration, then finished by hand: props schemas via useProps, refs via signal.ref, and `this.` on every component-scoped name in the templates
* the copied 19.0 core control-panel and breadcrumb markup is re-chased against 20.0 core: the Dropdown toggler slot, env.isSmall, switchView, and the list/graph button inherit targets all moved

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
Assisted-by: Claude Opus 5
Inserting a graph view into a spreadsheet raised "Cannot find odoo_pie in
this registry!" and nothing was created.

20.0 removed the `odoo_bar` / `odoo_line` / `odoo_pie` chart types. A chart
now carries the plain o-spreadsheet type and names Odoo as its data source,
which is also where metaData, searchParams, cumulatedStart and actionXmlId
moved -- core's own 19.3.10 migration step rewrites stored definitions the
same way. chartTypeRegistry only knows the plain keys, so the 19.0-shaped
`odoo_${mode}` threw on CREATE_CHART.

metaData.mode is deliberately not passed on: ChartDataSource derives the
GraphModel mode from the chart type.

The rest of the definition is trimmed to each type's allowedDefinitionKeys.
20.0 dropped `verticalAxisPosition` and `axisType` from bar/line/pie, allows
`stacked` only on bar and line, and `cumulative` only on line. Unknown keys
are deleted without a word, so leaving them in only wrote dead state into
the saved payload.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
Assisted-by: Claude Opus 5
Opening any chart's side panel threw "getChartOdooMenu is not a function".
The "Link to Odoo menu" section is extended into core's Generic, Bar, Line,
Gauge and Scorecard config panels, so this hit every chart, not just the
Odoo-sourced ones.

20.0 generalised the chart-to-menu reference into a chart-to-Odoo link that
can point at either a menu or a data source: the getter is getChartOdooLink
and returns the link record, and the command is UPDATE_ODOO_LINK_TO_CHART
taking `odooLink`, where clearing it is `undefined` rather than a false id.

getChartOdooLink already drops a link whose menu no longer resolves, but it
can also return a "dataSource" link, so the type is checked before reading
odooMenuId.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
Assisted-by: Claude Opus 5
Editing any Odoo-sourced chart threw "Cannot find odoo in this registry!"
from ChartDataSourceComponent, so the whole chart side panel failed to
render and the dialog was an "Oops!".

20.0 split the chart side panel: the generic part stays keyed by chart type,
while the data-source section is delegated to a component looked up in
chartDataSourceSidePanelComponentRegistry by `dataSource.type`. Core ships
only "range" -- the Odoo entry was an Enterprise one -- so nothing answered
for "odoo".

This is the 20.0 home for what the module used to register as
chartSidePanelComponentRegistry entries under `odoo_bar` / `odoo_pie` / ...,
keys that no longer exist. An Odoo chart has no ranges for the user to pick,
so the section names the view the chart reads from instead.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
Assisted-by: Claude Opus 5
@dnplkndll
dnplkndll force-pushed the 20.0-fix-spreadsheet_oca-ir-access branch from e1a13b1 to 21c6ed3 Compare November 12, 2026 01:14
20.0 merged ir.model.access and ir.rule into ir.access, where group-bound
entries are OR-ed. The converted access_spreadsheet_spreadsheet row kept the
ACL's empty domain, which is now Domain.TRUE and short-circuits the whole OR,
so owner/contributor/reader were dead code and any spreadsheet user could
read, write and delete every spreadsheet in their company.

On 19.0 the same pair was correct: the ACL granted the operation and the six
ir.rule records restricted the rows, composing as AND. Dropping the row
restores that.

owner_id gains copy=False -- duplicating someone else's spreadsheet copied
their owner_id, and the owner rule now rejects that create.

Adds the first tests in this module. They have to run as a plain group_user:
a TransactionCase is SUPERUSER_ID, which returns from check_access before any
ir.access is read, and admin is in group_manager, so neither would notice.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
Assisted-by: Claude Opus 5
@dnplkndll
dnplkndll force-pushed the 20.0-fix-spreadsheet_oca-ir-access branch from 21c6ed3 to 1243a29 Compare November 12, 2026 01:35
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.