Skip to content

[FIX] account_multi_store: do not ignore active_test on journal search - #112

Open
hav-adhoc wants to merge 1 commit into
ingadhoc:18.0from
adhoc-dev:18.0-h-127730-hav
Open

hav-adhoc wants to merge 1 commit into
ingadhoc:18.0from
adhoc-dev:18.0-h-127730-hav

Conversation

@hav-adhoc

Copy link
Copy Markdown

What

AccountJournal._search forces active_test=False on every search, so with this module installed archived journals are returned everywhere. This drops that. The store restriction is untouched, docstring included.

Why

l10n_ar._onchange_partner_journal looks for an export journal with a plain search. With this module installed it finds archived ones too, so an invoice for a foreign partner can end up assigned to an archived journal. Any other default or selector built on a journal search has the same problem.

It also turns the 18.0 runbot red: l10n_ar got a test for this in odoo/odoo (e471c26fcc6a, 2026-08-18) and it fails only on a database with the full OBA set installed.

Archived journals stay reachable the standard way, which is what #77 was after:

  • a domain on active (what the UI "Archived" filter sends) still returns them;
  • active_test=False in the context still returns them;
  • unarchiving a journal still works;
  • a record already pointing at an archived journal reads and writes the same as before.

The only behaviour that changes is that an archived journal no longer shows up in m2o dropdowns (name_search), which matches stock Odoo.

Test plan

  • New account_multi_store/tests/test_account_journal.py: an archived journal is not returned by a plain search, and is returned when asked for by domain or by context. It fails on 18.0 as is and passes with this change.
  • Reproduced on a database with the full OBA set: TestArManual.test_foreign_partner_without_expo_journal fails with this module installed and passes with this change; on the same database without the module it passes either way.

Internal reference: https://www.adhoc.inc/odoo/helpdesk.ticket/127730

cc @rov-adhoc — this drops the _search part of #77. If the case behind it was seeing an archived journal in a dropdown, that is better solved with active_test=False in the context of that field or action.

The _search override disabled active_test for every account.journal
search, so archived journals were returned everywhere. l10n_ar picks an
export journal through a plain search, so an invoice for a foreign
partner could be assigned to an archived journal.

Archived journals stay reachable the standard way: a domain on active
(what the Archived filter sends) or active_test=False in the context.
The store restriction is not changed.

Change note: con Multi Store instalado, los diarios archivados dejan de
aparecer en las búsquedas de diarios. El filtro "Archivado" y el
desarchivar un diario siguen funcionando igual.
@roboadhoc

Copy link
Copy Markdown

Pull request status dashboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants