Skip to content

[FIX] multi_store: allow reading records of other stores by id - #116

Closed
fw-bot-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-18.0-h-132306-rov-11671-fw
Closed

fw-bot-adhoc wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-18.0-h-132306-rov-11671-fw

Conversation

@fw-bot-adhoc

Copy link
Copy Markdown

Ticket: https://www.adhoc.inc/odoo/helpdesk.ticket/132306

Since 17.0, fetch() resolves the ids through _search() as the current user. The store filter that account.journal, sale.order and stock.picking.type add in _search() was meant only to restrict choosing records, but now it also forbids reading them by id: a user of one store can no longer open an entry, transfer or order of another store (read access error). Up to 16.0 this was allowed.

fetch() now reads with the skip_store_filter context, which _search() honors. Choosing records stays filtered by store, and writing on records of other stores stays forbidden by the record rules.

The new env keeps env.company and env.companies: it passes them as allowed_company_ids, with env.company first. env.company is part of the cache key of company-dependent fields: without it, the values fetched were cached under the user's default company, and reading them in an env whose company was set directly (as demo_full tests do with self.env.company = ...) raised MissingError. with_company() alone is not enough: without allowed_company_ids in the context it leaves only that company allowed, and the multi-company rules then forbid reading records of the user's other companies.

Tests added in the three modules: they fail without the fix and pass with it.

Forward-Port-Of: #115

stdout:
CONFLICT (modify/delete): account_multi_store/models/account_journal.py deleted in 0b88fff and modified in 06c8836.  Version 06c8836 of account_multi_store/models/account_journal.py left in tree.
CONFLICT (modify/delete): sale_multi_store/models/sale_order.py deleted in 0b88fff and modified in 06c8836.  Version 06c8836 of sale_multi_store/models/sale_order.py left in tree.
CONFLICT (modify/delete): stock_multi_store/models/stock_picking_type.py deleted in 0b88fff and modified in 06c8836.  Version 06c8836 of stock_multi_store/models/stock_picking_type.py left in tree.

stderr:
@roboadhoc

Copy link
Copy Markdown

Pull request status dashboard

@fw-bot-adhoc

Copy link
Copy Markdown
Author

@rov-adhoc @maq-adhoc cherrypicking of pull request #115 failed.

stdout:

CONFLICT (modify/delete): account_multi_store/models/account_journal.py deleted in 0b88fffc536f9dc22ceb97c3234814536d37558b and modified in 06c8836573da75bd698f5967f34272c0be0485e3.  Version 06c8836573da75bd698f5967f34272c0be0485e3 of account_multi_store/models/account_journal.py left in tree.
CONFLICT (modify/delete): sale_multi_store/models/sale_order.py deleted in 0b88fffc536f9dc22ceb97c3234814536d37558b and modified in 06c8836573da75bd698f5967f34272c0be0485e3.  Version 06c8836573da75bd698f5967f34272c0be0485e3 of sale_multi_store/models/sale_order.py left in tree.
CONFLICT (modify/delete): stock_multi_store/models/stock_picking_type.py deleted in 0b88fffc536f9dc22ceb97c3234814536d37558b and modified in 06c8836573da75bd698f5967f34272c0be0485e3.  Version 06c8836573da75bd698f5967f34272c0be0485e3 of stock_multi_store/models/stock_picking_type.py left in tree.

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

:shipit: you can use git-fw to re-do the forward-port for you locally.

⚠️ after resolving this conflict, you will need to merge it via @roboadhoc.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@rov-adhoc rov-adhoc closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants