Skip to content

[16.0][FIX] Update dotfiles and unit test code#1422

Merged
OCA-git-bot merged 3 commits into
OCA:16.0from
ivilata:16.0-fix-pre-commit-update-dotfiles
May 12, 2026
Merged

[16.0][FIX] Update dotfiles and unit test code#1422
OCA-git-bot merged 3 commits into
OCA:16.0from
ivilata:16.0-fix-pre-commit-update-dotfiles

Conversation

@ivilata
Copy link
Copy Markdown

@ivilata ivilata commented Apr 28, 2026

Mainly to avoid ModuleNotFoundError: No module named 'pkg_resources' when running the setuptools-odoo pre-commit hook (e.g. run by CI), as v3.1.8 was bitten by the removal of pkg_resources from recent versions of setuptools. This was fixed by v1.38 of oca-addons-repo-template by updating setuptools-odoo to v3.3.2.

See #1421 for more more information.

Update 2026-05-12: This also updates contract_payment_auto and subscription_oca unit tests to avoid a few assorted errors that crept in with other commits. These should unlock merging in other PRs.

Mainly to avoid `ModuleNotFoundError: No module named 'pkg_resources'` when
running the `setuptools-odoo` pre-commit hook, as v3.1.8 was bitten by the
removal of `pkg_resources` from recent versions of `setuptools`.  This was
fixed by v1.38 of `oca-addons-repo-template` by updating `setuptools-odoo` to
v3.3.2.

See OCA#1421 for more more information.
@ivilata
Copy link
Copy Markdown
Author

ivilata commented Apr 28, 2026

As mentioned in the other ticket, KeyError: 'test_target_state' in TestContract tests are pre-existing.

Copy link
Copy Markdown
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, to merge this, we need to fix the error in the tests.

@ivilata
Copy link
Copy Markdown
Author

ivilata commented Apr 29, 2026

Thanks @pedrobaeza for the review.

Umm… So a merge is not possible if there are unrelated test failures?

I wonder if creating additional PRs for solving the other issues won't work since they will be blocked by this one, while this one is blocked by the others.

In that case, should the fixes to the other problems be included in this PR as well? 🤔

@pedrobaeza
Copy link
Copy Markdown
Member

Yeah, it should be included in this PR.

This includes a couple of `_do_auto_pay` tests which were missing a
`test_target_state` context (added in later commits), and a `_pay_invoice`
test which did not clear the invoice's residual amount.
@OCA-git-bot OCA-git-bot added series:16.0 mod:contract_payment_auto Module contract_payment_auto labels Apr 29, 2026
@ivilata ivilata marked this pull request as draft May 5, 2026 09:44
@OCA-git-bot OCA-git-bot added the mod:subscription_oca Module subscription_oca label May 5, 2026
@ivilata ivilata force-pushed the 16.0-fix-pre-commit-update-dotfiles branch 6 times, most recently from 321f8c5 to 8276633 Compare May 12, 2026 07:55
So that they can pay refunds etc. no matter what account in arbitrarily chosen
when creating an invoice from a subscription.  This avoids "UserError: The
company bank account linked to this invoice is not trusted, please
double-check and trust it before confirming, or remove it" in
`TestSubscriptionOCA.test_subscription_oca_sub8_workflow`.
@ivilata ivilata force-pushed the 16.0-fix-pre-commit-update-dotfiles branch from 8276633 to 6163e0a Compare May 12, 2026 08:33
@ivilata ivilata marked this pull request as ready for review May 12, 2026 08:54
@ivilata ivilata requested a review from pedrobaeza May 12, 2026 08:55
@ivilata
Copy link
Copy Markdown
Author

ivilata commented May 12, 2026

@pedrobaeza: It took me some time, but at last I was able to fix the remaining unit test errors. I understand that, since the fixes are unrelated but need to be pushed in a single blow to avoid the chicken-and-egg situation mentioned above, it's better not to squash them together.

@ivilata ivilata changed the title [16.0][IMP] Update dotfiles to fix pre-commit dependencies issues [16.0][FIX] Update dotfiles and unit test code May 12, 2026
invoice = self._create_invoice()
invoice.state = "posted"
invoice = self._create_invoice(True)
invoice.amount_residual = 0.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricking too much the aim of the tests, as this is saying there's no debt. Not sure though if the tests were OK before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pedrobaeza for the comment, I'm struggling quite blindly with these unrelated test errors…

Honestly, I don't know if posting or even sending (i.e. self._create_invoice(True, True)) are supposed to clear the residual in the test context (note: they don't), or if some other operation should be issued in the middle (hints welcome!).

At any rate, this contract_payment_auto module doesn't even exist in 17.0 nor 18.0, I wonder if just dropping the test would make sense at this point if we fail to make sense out of it. 🤷

@pedrobaeza
Copy link
Copy Markdown
Member

OK, let's continue for now this way, and let that tests as an eccentricity, hehe, but for sure it's not correct (and I'm pretty sure it wasn't before).

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-1422-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 5729014 into OCA:16.0 May 12, 2026
7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 6268396. Thanks a lot for contributing to OCA. ❤️

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

Labels

merged 🎉 mod:contract_payment_auto Module contract_payment_auto mod:subscription_oca Module subscription_oca series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants