[18.0][FIX] contract: do not suggest archived products in contract lines - #1490
Conversation
| { | ||
| "name": "Recurring - Contracts Management", | ||
| "version": "18.0.2.5.0", | ||
| "version": "18.0.2.5.1", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Hi Pedro
Sorry for that! I have reset the version.
|
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.
c55b4da to
6459aa9
Compare
done |
|
/ocabot merge patch Can you fw-port it to 19? |
|
What a great day to merge this nice PR. Let's do it! |
|
Congratulations, your PR was merged at ce523fb. Thanks a lot for contributing to OCA. ❤️ |
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.