Skip to content

[18.0][FIX] hr_collective_agreement: load the multi-company record rule - #1645

Open
parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-hr_collective_agreement-company-rule
Open

parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-hr_collective_agreement-company-rule

Conversation

@parabol123654

@parabol123654 parabol123654 commented Nov 2, 2026 •

Copy link
Copy Markdown

hr_collective_agreement/security/collective_agreement_security.xml defines the multi-company rule of collective.agreement:

['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]

The file is not listed in the manifest, so the rule is never loaded. As a result, a user who only has access to company B sees (and can open) the collective agreements of company A.

Changes:

  • Manifest: add the file to the manifest.

  • Second rule removed (collective_agreement_rule_partner_manager), for two reasons:

    • It refers to base.group_hr_manager, which does not exist (the group is hr.group_hr_manager). Loading the file as it is would fail the module install.
    • Its domain is [(1, '=', 1)], so it would let HR managers see every company's agreements and bypass the multi-company rule. Core hr has no such exception.

    If an HR-manager exception is actually wanted, I can restore it with hr.group_hr_manager instead.

Test: test_multi_company_rule checks that an employee and an HR manager of another company see only that company's agreements.

  • It fails without the manifest change: collective.agreement(1,) unexpectedly found in collective.agreement(1, 7).
  • With the fix, hr_collective_agreement passes 11/11 and hr_collective_agreement_partner passes 5/5.

The module is not on 19.0 yet.

Assisted-by: Claude Opus 5.5

@OCA-git-bot OCA-git-bot added series:18.0 mod:hr_collective_agreement Module hr_collective_agreement labels Nov 2, 2026
security/collective_agreement_security.xml was never listed in the
manifest, so collective agreements of every company were visible to
users of any company.

Load the file. Its second rule is dropped: it referenced a group that
does not exist (base.group_hr_manager, the module would not install)
and, with a [(1, '=', 1)] domain, would have let HR managers bypass the
multi-company rule.

Assisted-by: Claude Opus 5.5
@parabol123654
parabol123654 force-pushed the 18.0-fix-hr_collective_agreement-company-rule branch from ccaa886 to 77a77c5 Compare November 14, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:hr_collective_agreement Module hr_collective_agreement series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants