[16.0][FIX] pms: keep pms_property_ids available when restricting it by group - #441
Merged
OCA-git-bot merged 2 commits intoAug 24, 2026
Conversation
multi_pms_properties injects a domain referring to the property field of the model into every relational field declared with check_pms_properties=True. product.pricelist.item_ids and product.pricelist.item.product_tmpl_id are among them, and both are shown by the inherited core views without any group. Odoo refuses to validate a view where a field used in the domain of another field is restricted to a narrower group, so restricting pms_property_ids with groups="pms.group_pms_user" makes the pricelist views fail validation: odoo.tools.convert.ParseError: while parsing product_pricelist_views.xml:3 Field 'pms_property_ids' used in domain of field 'item_ids' is restricted to the group(s) pms.group_pms_user. The view no longer loads, so the module cannot be installed or updated. Keep the field available for the remaining users with a hidden companion node, the same pattern core uses for company_id with check_company, so it is still only displayed to PMS users. Add a test that validates the affected views with the domain injection active.
…variant Any view showing a field of a model with check_pms_properties fields must keep pms_property_id(s) available for every group combination, otherwise Odoo cannot validate it. Document the companion node pattern to hide it instead.
Member
Author
|
/ocabot merge patch |
Contributor
|
Hey, thanks for contributing! Proceeding to merge this for you. |
Contributor
|
Congratulations, your PR was merged at c6ab9d1. Thanks a lot for contributing to OCA. ❤️ |
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.
Regression from #440.
Problem
multi_pms_propertiesinjects a domain into every relational field declared withcheck_pms_properties=True, and that domain refers to the property field of the model:https://github.com/OCA/pms/blob/16.0/multi_pms_properties/__init__.py#L51-L54
On
product.pricelistfive fields carry that domain,item_idsamong them, and onproduct.pricelist.itemfour do,product_tmpl_idandpricelist_idamong them. All ofthem are displayed by the inherited core views without any group.
Odoo refuses to validate a view where a field used in the domain of another field is
restricted to a narrower group (
ir_ui_view.py#L3053),so adding
groups="pms.group_pms_user"topms_property_idsbreaks the whole view:The view no longer loads, so
pmscannot be installed or updated on any database withmulti_pms_propertiesloaded throughserver_wide_modules. It is not a cosmetic issue.Why CI did not catch it
The domain injection is gated on
multi_pms_propertiesbeing inserver_wide_modules,which is not the case when running the test suite, so the injected domain never exists
there and the views validate fine.
For the record, I could not pin down why a fresh install passes while updating an existing
database fails, even with the patch active in both. I would rather say so than guess: the
failure is reproducible on update, and the fix below is correct regardless of the trigger.
Fix
Keep the field available for the remaining users with a hidden companion node, which is
the pattern core uses for
company_idwithcheck_company(61 occurrences ofgroups="!"in core views), for instance
account_move_views.xml#L417-L418:The field stays available in the arch for every group combination while it is only
displayed to PMS users, so the intent of #440 is preserved.
Only two views need it.
product_template_views.xmlandres_partner_views.xmlare leftuntouched on purpose: the only
check_pms_propertiesfield of those models ispms_property_idsitself, which is restricted to the same group that makes it mandatory,so it is self-consistent.
Test
pms/tests/test_view_check_pms_properties.pyvalidates the affected views with the domaininjection patched in explicitly, so it does not depend on
server_wide_modulesandreproduces a real deployment instead of silently passing.
To be clear about what I did and did not verify: the failure and the fix are confirmed on
an update of an existing database, but I have not run this test suite myself, so I am
relying on this PR's CI for it. Please double check that it does fail without the view
changes; if it does not, the trigger is narrower than the test assumes and the test needs
work before it is worth keeping.
Also documented the invariant in
multi_pms_propertiesusage, since this is an easy trapto fall into again from any module adding
groupsto a property field.