[16.0][FIX] pms: hide PMS-only fields from users without PMS access - #440
Merged
OCA-git-bot merged 1 commit intoAug 24, 2026
Merged
Conversation
DarioLodeiros
force-pushed
the
16.0-fix-pms-fields-non-pms-users
branch
from
August 24, 2026 14:30
83afbd2 to
23398eb
Compare
Views inherited from res.partner, product.template, product.pricelist and
product.pricelist.item add PMS fields without any group restriction. Any
internal user without a PMS group gets an AccessError when opening those
forms, because those fields (or their computes) read PMS models whose ACLs
are limited to pms.group_pms_user / pms.group_pms_manager:
- res.partner: reservations_count computes over pms.checkin.partner
- product.template / product.product: property_daily_limits reads
ir.pms.property
- product.pricelist: pms_sale_channel_ids reads pms.sale.channel
- product.pricelist.item: allowed_board_service_room_type_ids reads
pms.board.service.room.type
This only shows up on databases where the PMS coexists with other business
lines, that is, where some internal users legitimately have no PMS group.
Add groups="pms.group_pms_user" to those elements so that they are dropped
from the arch for users without PMS access, keeping the rest of the form
usable. Whole blocks are guarded instead of only the offending field, so a
field referenced from the attrs or domain of a sibling does not vanish on
its own and break the view.
Also drop the commented-out groups_id line on the res.partner view: Odoo 16
rejects groups_id on inherited views ("Inherited view cannot have 'groups'
defined in the record"), so the groups attribute is the supported way to do
this.
DarioLodeiros
force-pushed
the
16.0-fix-pms-fields-non-pms-users
branch
from
August 24, 2026 14:36
23398eb to
9be1552
Compare
Member
Author
|
/ocabot merge minor |
Contributor
|
On my way to merge this fine PR! |
Contributor
|
Congratulations, your PR was merged at 43f7c06. 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.
Problem
On a database where the PMS coexists with other business lines, any internal user without a PMS group gets an
AccessErrorwhen opening plain business forms:The views this module inherits add PMS fields without any group restriction, and those fields (or their computes) read PMS models whose ACLs are limited to
pms.group_pms_user/pms.group_pms_manager:res.partnerreservations_count(compute)pms.checkin.partnerproduct.template/product.productproperty_daily_limitsir.pms.propertyproduct.pricelistpms_sale_channel_idspms.sale.channelproduct.pricelist.itemallowed_board_service_room_type_idspms.board.service.room.typeIt goes unnoticed on hotel-only databases, where every internal user has a PMS group. It shows up as soon as the same Odoo hosts staff unrelated to the property (accounting, sales, another business unit), who then cannot open a contact, a product or a pricelist at all.
How to reproduce
base.group_user(and, to rule out unrelated ACLs,base.group_system) and no PMS group.AccessErroronpms.checkin.partner.Fix
Add
groups="pms.group_pms_user"to those elements, so they are dropped from the arch for users without PMS access while the rest of the form stays usable.Whole blocks are guarded rather than only the offending field: when a guarded field is referenced from the
attrsordomainof a sibling that stays visible (is_pms_availableon the pricelist,allowed_board_service_room_type_idsin the domain ofboard_service_room_type_id), hiding it alone breaks the view for a different reason.The commented-out
groups_idline on theres.partnerview is dropped as well: Odoo 16 rejectsgroups_idon inherited views ("Inherited view cannot have 'groups' defined in the record"), so thegroupsattribute is the supported mechanism.Testing
Verified on a production database hosting a hotel plus an unrelated business line, with three profiles — an administrator without PMS groups, a plain internal user, and a PMS manager — across
res.partner,product.template,product.product,product.pricelist,product.pricelist.item,account.journal,account.move,account.move.line,account.payment,account.bank.statement,res.usersandres.company: no access errors after the change, and users with PMS groups keep seeing every PMS field as before.