Conversation
…nt search to one
_compute_unaffected_earnings_account in trial_balance_wizard and
general_ledger_wizard assigns a Many2one field but the search domain
("company_ids", "in", ...) on account.account can match multiple
records in multi-company setups (equity_unaffected accounts typically
exist per company). Without limit=1 the assignment raises:
ValueError: Wrong value for <wizard>.unaffected_earnings_account:
account.account(X, Y)
Add limit=1 to both wizards. The 19.0 branch is unaffected because
the compute was refactored to delegate to
res.company.get_unaffected_earnings_account().
Signed-off-by: Don Kendall <dkendall@ledoweb.com>
…ted_earnings_account search Add order="id" to the limit=1 search in both wizards so the result is stable when a company has multiple equity_unaffected accounts, rather than depending on Postgres row order.
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.
What
_compute_unaffected_earnings_accountintrial_balance_wizardandgeneral_ledger_wizardassigns to aMany2onefield (store=True), but the search domain onaccount.account.company_idscan match multiple records in multi-company setups (anequity_unaffectedaccount typically exists per company). Withoutlimit=1, the assignment raises:This PR adds
limit=1to both wizards.Why
The
Many2onewrite strictly rejects multi-record values in modern Odoo ORM (any leniency older versions had no longer applies). The bug surfaces deterministically once a second company with anequity_unaffectedaccount exists — the existing_only_one_unaffected_earnings_accounthelper in both wizards even acknowledges this case but the compute itself doesn't honor it.19.0 is unaffected — the compute was refactored upstream to delegate to
res.company.get_unaffected_earnings_account().How
Two-line change, one per wizard. No behavior change in single-company environments.
Fork-mirror note
Opened against the ledoent fork's 18.0 first so it can be reviewed before being submitted as
[18.0][FIX]toOCA/account-financial-reporting. The branch (18.0-fix-unaffected-earnings-limit) is based onOCA/18.0head; the identical commit will go upstream once approved here.