[19.0][IMP] contract: restrict pricelist selection to the contract's company#1488
Open
bosd wants to merge 1 commit into
Open
[19.0][IMP] contract: restrict pricelist selection to the contract's company#1488bosd wants to merge 1 commit into
bosd wants to merge 1 commit into
Conversation
pedrobaeza
approved these changes
Jul 17, 2026
pedrobaeza
left a comment
Member
There was a problem hiding this comment.
Cannot be this managed by check_company or similar attribute?
The pricelist_id field on contract.contract and contract.template had no
company domain, so a pricelist from any company could be selected -- including
a company the contract's users cannot read. That silently creates cross-company
records that later raise "product pricelist company rule" access errors (e.g.
when a line's price is computed).
Add the standard company domain (mirroring sale.order.pricelist_id):
domain="[('company_id', 'in', (company_id, False))]" -- the contract's own
company or a shared (company-less) pricelist.
bosd
force-pushed
the
19.0-imp-contract-pricelist-company-domain
branch
from
July 17, 2026 14:24
706ddca to
bf7fa85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
pricelist_idoncontract.contractandcontract.templatehas no company domain, so a pricelist belonging to any company can be selected on a contract — including a company whose pricelists the contract's users can't read. That silently creates cross-company records which later raise aproduct pricelist company ruleaccess error (typically when a line's price is computed and the foreign-company pricelist is read).Fix
Add the same company domain Odoo's
sale.order.pricelist_iduses:on both the contract form and the contract-template form — restricting selection to the record's own company or a shared (company-less) pricelist.
company_idis auto-included by the view for the domain (as it is forsale.order).Preventive only — it doesn't migrate existing mismatched data; that's a one-off data fix.