Skip to content

[18.0][BUG] account_operating_unit: payment register wizard shows journals from wrong OU #843

Description

@IJOL

Module

account_operating_unit

Describe the bug

When registering a payment from the invoice form, the payment wizard (account.payment.register) does not filter available journals by the invoice's operating unit.

Steps to reproduce

  1. Configure two operating units (OU_A, OU_B) with separate bank/cash journals
  2. Create a user with access to only OU_B
  3. Create and post a vendor bill assigned to OU_B
  4. Click Register Payment on the bill

Current behavior

  • The journal dropdown shows journals from all OUs (including OU_A)

  • The default journal may be from OU_A

  • Clicking "Create Payment" raises AccessError:

    COMPANY (id=X) does not have 'read' access to: Journal (account.journal)

    Because the ir.rule "Journals from allowed operating units" blocks access to OU_A journals for the OU_B user.

Expected behavior

  • Only journals matching the invoice's OU (or with no OU) should appear in the dropdown
  • The default journal should be from the invoice's OU
  • Payment creation should succeed without AccessError

Root cause

account.payment.register._get_batch_available_journals() (core Odoo) searches journals filtered by company and type, but account_operating_unit does not extend this method to add OU filtering. The ir.rule filters by the user's OUs, but when a user has access to multiple OUs, journals from all their OUs appear — even when paying an invoice from a specific OU.

Affected versions

  • 18.0 (confirmed)
  • Likely affects 16.0 and 17.0 as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions