[19.0][FIX] purchase_advance_payment: load a chart template in tests - #3159
Open
rahu-dynapps wants to merge 1 commit into
Open
[19.0][FIX] purchase_advance_payment: load a chart template in tests#3159rahu-dynapps wants to merge 1 commit into
rahu-dynapps wants to merge 1 commit into
Conversation
The test setup creates an account.tax, which requires both a tax group and a fiscal country. On a database where no chart of accounts has been loaded yet, account.tax.group is empty and account.tax.create fails on the tax_group_id NOT NULL constraint. The payment tests then also need journals and outstanding accounts. Load generic_coa when the company has no chart template, so the tests run on a freshly initialized database as well.
Contributor
|
Hi @LoisRForgeFlow, |
LoisRForgeFlow
approved these changes
Sep 4, 2026
LoisRForgeFlow
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the analysis and the fix, it makes sense 👍
Contributor
|
/ocabot merge patch |
Contributor
|
What a great day to merge this nice PR. Let's do it! |
Contributor
|
@LoisRForgeFlow your merge command was aborted due to failed check(s), which you can inspect on this commit of 19.0-ocabot-merge-pr-3159-by-LoisRForgeFlow-bump-patch. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
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.
Problem
TestPurchaseAdvancePayment.setUpClasscreates anaccount.tax. On a database where no chart of accounts has been loaded yet, there is noaccount.tax.groupand no fiscal country on the company, so the record cannot be created:This happens on any freshly initialized database without demo data, for instance a new build on a hosting platform that installs the module from scratch. Chart templates are only auto-loaded after the module loading phase, so the tests run before any chart is available.
The payment tests have the same underlying need: without a chart,
account.payment.createraisesNo outstanding account could be found to make the payment.Fix
Load
generic_coainsetUpClasswhen the company has no chart template yet. Databases that already have a chart (a real database, or the OCA CI with demo data) are untouched by the guard.Test
-i purchase_advance_payment --test-enable --without-demo=all: 12/12 green (fails ontax_group_idwithout the patch).