Skip to content

[16.0][FIX] pms: hide PMS-only fields from users without PMS access - #440

Merged
OCA-git-bot merged 1 commit into
OCA:16.0from
commitsun:16.0-fix-pms-fields-non-pms-users
Aug 24, 2026
Merged

[16.0][FIX] pms: hide PMS-only fields from users without PMS access#440
OCA-git-bot merged 1 commit into
OCA:16.0from
commitsun:16.0-fix-pms-fields-non-pms-users

Conversation

@DarioLodeiros

Copy link
Copy Markdown
Member

Problem

On a database where the PMS coexists with other business lines, any internal user without a PMS group gets an AccessError when opening plain business forms:

You are not allowed to access 'Partner Checkins' (pms.checkin.partner) records.

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:

Form Field Model it reads
res.partner reservations_count (compute) pms.checkin.partner
product.template / product.product property_daily_limits ir.pms.property
product.pricelist pms_sale_channel_ids pms.sale.channel
product.pricelist.item allowed_board_service_room_type_ids pms.board.service.room.type

It 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

  1. Take a user with base.group_user (and, to rule out unrelated ACLs, base.group_system) and no PMS group.
  2. Open any contact form → AccessError on pms.checkin.partner.
  3. Same with a product, a pricelist and a pricelist item, on the models listed above.

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 attrs or domain of a sibling that stays visible (is_pms_available on the pricelist, allowed_board_service_room_type_ids in the domain of board_service_room_type_id), hiding it alone breaks the view for a different reason.

The commented-out groups_id line on the res.partner view is dropped as well: Odoo 16 rejects groups_id on inherited views ("Inherited view cannot have 'groups' defined in the record"), so the groups attribute 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.users and res.company: no access errors after the change, and users with PMS groups keep seeing every PMS field as before.

@DarioLodeiros
DarioLodeiros force-pushed the 16.0-fix-pms-fields-non-pms-users branch from 83afbd2 to 23398eb Compare August 24, 2026 14:30
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
DarioLodeiros force-pushed the 16.0-fix-pms-fields-non-pms-users branch from 23398eb to 9be1552 Compare August 24, 2026 14:36
@DarioLodeiros

Copy link
Copy Markdown
Member Author

/ocabot merge minor

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-440-by-DarioLodeiros-bump-minor, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit eb421fc into OCA:16.0 Aug 24, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 43f7c06. 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.

2 participants