-
-
Notifications
You must be signed in to change notification settings - Fork 439
[16.0][FIX] account_payment_return: Post-install test + fallback to load CoA #803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][FIX] account_payment_return: Post-install test + fallback to load CoA #803
Conversation
Since odoo/odoo@d0342c8, the default existing company is not getting a CoA automatically, provoking than the current tests fail with the error: odoo.exceptions.UserError: No journal could be found in company My Company (San Francisco) for any of those types: sale Thus, we put tests post-install for being sure localization modules are installed, the same as AccountTestInvoicingCommon does, but we don't inherit from it, as it creates an overhead creating 2 new companies and loading their CoA and some more stuff, while we don't need all of that. Besides, if you don't have `l10n_generic_coa` installed, you can't use another CoA (like `l10n_es`) easily, so we put little code to select the first available CoA.
…load CoA Since odoo/odoo@d0342c8, the default existing company is not getting a CoA automatically, provoking than the current tests fail with the error: odoo.exceptions.UserError: No journal could be found in company My Company (San Francisco) for any of those types: sale Thus, we put tests post-install for being sure localization modules are installed, the same as AccountTestInvoicingCommon does, but we don't inherit from it, as it creates an overhead creating 2 new companies and loading their CoA and some more stuff, while we don't need all of that. Besides, if you don't have `l10n_generic_coa` installed, you can't use another CoA (like `l10n_es`) easily, so we put little code to select the first available CoA.
account_payment_return_import_iso20022/wizard/payment_return_import.py
Outdated
Show resolved
Hide resolved
0cac721
to
af495de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still seems incorrect. You should call super
when the file is not a XML one.
Sorry, but why block this if the fix in this related case “Post-install test + fallback to load CoA” is clear? I at least am not going to defend why this is this way account-payment/account_payment_return_import_iso20022/wizard/payment_return_import.py Lines 48 to 62 in 977c1a2
|
It's not changing the behavior, but fixing the behavior in the proper way. All of this have been because passing to post-install has uncovered a problem, and the problem is that the architecture, as it's though, it's not being respected in the iso20022 module, as instead of calling super when the file is not an XML to let the CSV parser to act, it's just aborting the import process. What you have done with the concatenated try/reraise is to play with the exception types to bypass it, but it's not the proper fix. Look that this same scheme is done on the statement import, and how is handled in N43 format: so what you have to do is to catch that a file is not XML (or even not the expected XSD format), and if not, call super for letting the rest of the parsers to act. |
The error in the tests detected was precisely because in
With the current change it ends up calling super() in account-payment/account_payment_return_import_iso20022/wizard/payment_return_import.py Line 62 in 977c1a2
The code is not pretty and/or readable, yes, but I guess, that would be another debate. |
Well, let me do it the changes I have in mind by myself and check the current test suite. Maybe that one is not correct as well. |
… chain Each extra importer shouldn't stop the parsing chain. This wasn't be detected before, because the base test was already executed before installing this module, but now in post-install, this is highlighted. The fix is to catch any possible error and continue calling super.
af495de
to
65cab8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@victoralmau you can see now what I was talking about. You have to call super, but in the proper method that is doing the iteration.
/ocabot merge patch
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 7e5722f. Thanks a lot for contributing to OCA. ❤️ |
Since odoo/odoo@d0342c8, the default existing company is not getting a CoA automatically, provoking than the current tests fail with the error:
odoo.exceptions.UserError: No journal could be found in company My Company (San Francisco) for any of those types: sale
Thus, we put tests post-install for being sure localization modules are installed, the same as AccountTestInvoicingCommon does, but we don't inherit from it, as it creates an overhead creating 2 new companies and loading their CoA and some more stuff, while we don't need all of that.
Besides, if you don't have
l10n_generic_coa
installed, you can't use another CoA (likel10n_es
) easily, so we put little code to select the first available CoA.@Tecnativa