[18.0][FIX] account_operating_unit: filter payment register journals by OU (#843)#844
Open
[18.0][FIX] account_operating_unit: filter payment register journals by OU (#843)#844
Conversation
When registering a payment from the invoice form, the payment wizard shows journals from all operating units instead of filtering by the invoice's operating unit. This causes AccessError when users with restricted OU access try to create payments. Override _get_batch_available_journals in account.payment.register to filter journals by the invoice's operating unit when all invoices in the batch belong to the same OU.
554dbbf to
8c13f76
Compare
AaronHForgeFlow
approved these changes
Apr 9, 2026
Contributor
AaronHForgeFlow
left a comment
There was a problem hiding this comment.
Code review LGTM
| .create(inv_vals) | ||
| ) | ||
| invoice.action_post() | ||
|
|
Contributor
There was a problem hiding this comment.
sorry for the nitpicking, can you remove all the empty lines inside the method?
The 8c13f76 fix added _get_batch_available_journals override but shipped without a regression test. This adds one: a B2B-only user pays a B2B invoice via the Register Payment wizard, and the available_journal_ids must NOT include OU1 journals.
f07358c to
35f9779
Compare
IJOL
added a commit
to BITVAX/operating-unit
that referenced
this pull request
Apr 13, 2026
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.
Fixes #843 — payment register wizard shows journals from wrong OU
Problem (see #843)
When registering a payment from the invoice form, the payment wizard shows journals from all operating units instead of filtering by the invoice's OU. Users with restricted OU access get AccessError when creating payments.
Steps to reproduce
Fix
Override
_get_batch_available_journalsinaccount.payment.registerto filter journals by the invoice's operating unit when all invoices in the batch share the same OU.Test
Added
test_payment_register_journals_filtered_by_ou— creates a vendor bill for a specific OU, opens payment wizard, asserts only matching journals are available, and confirms payment creation succeeds.