Skip to content

[18.0][FIX] contract: do not suggest archived products in contract lines - #1490

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
renzo1974:18.0-fix-contract-line-archived-products
Jul 29, 2026
Merged

[18.0][FIX] contract: do not suggest archived products in contract lines#1490
OCA-git-bot merged 1 commit into
OCA:18.0from
renzo1974:18.0-fix-contract-line-archived-products

Conversation

@renzo1974

Copy link
Copy Markdown
Contributor

The contract_line_ids / contract_line_fixed_ids one2many fields define context={"active_test": False} so that archived (closed) contract lines stay visible in the contract form.

However, the web client propagates this context to every RPC issued from within the lines — including name_search on the product_id and uom_id many2one fields. As a result, archived products and UoMs show up in the dropdowns when adding or editing a contract line.

Steps to reproduce:
archive a product → open a contract → add a line → search the product: the archived product is suggested.

This PR restores the default behaviour by explicitly setting active_test: True on those fields in the embedded line lists and in the line form dialog, while archived contract lines remain visible as intended.

@pedrobaeza pedrobaeza changed the title [FIX] contract: do not suggest archived products in contract lines [18.0][FIX] contract: do not suggest archived products in contract lines Jul 29, 2026
@pedrobaeza pedrobaeza added this to the 18.0 milestone Jul 29, 2026
Comment thread contract/__manifest__.py Outdated
{
"name": "Recurring - Contracts Management",
"version": "18.0.2.5.0",
"version": "18.0.2.5.1",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please don't change manually the module version. It can conflict if multiple PRs are done against the same module. This will be bumped by the bot on merging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi Pedro
Sorry for that! I have reset the version.

@pedrobaeza

Copy link
Copy Markdown
Member

Please squash both commits into one. And FYI, this is still modifying the version (first putting a version, and the reverting back), so the conflict will happen the same.

The contract_line_ids and contract_line_fixed_ids one2many fields set
active_test=False in their context so that archived (closed) contract
lines remain visible in the contract form. The web client propagates
this context to every RPC issued from within the lines, including the
name_search of the product_id and uom_id many2one fields. As a result,
archived products and units of measure were suggested in the dropdowns.

Restore the default behaviour by explicitly setting active_test=True on
these fields in the embedded line lists and in the line form dialog.
@renzo1974
renzo1974 force-pushed the 18.0-fix-contract-line-archived-products branch from c55b4da to 6459aa9 Compare July 29, 2026 08:39
@renzo1974

Copy link
Copy Markdown
Contributor Author

Please squash both commits into one. And FYI, this is still modifying the version (first putting a version, and the reverting back), so the conflict will happen the same.

done

@pedrobaeza
pedrobaeza requested a review from victoralmau July 29, 2026 08:42
@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot merge patch

Can you fw-port it to 19?

@OCA-git-bot

Copy link
Copy Markdown
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-1490-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit 7bd33d3 into OCA:18.0 Jul 29, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at ce523fb. Thanks a lot for contributing to OCA. ❤️

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.

4 participants