Skip to content

[19.0][MIG] auth_jwt: Migration to 19.0#844

Open
pablo-cort-s73 wants to merge 48 commits into
OCA:19.0from
Studio73:19.0-mig-auth_jwt
Open

[19.0][MIG] auth_jwt: Migration to 19.0#844
pablo-cort-s73 wants to merge 48 commits into
OCA:19.0from
Studio73:19.0-mig-auth_jwt

Conversation

@pablo-cort-s73

@pablo-cort-s73 pablo-cort-s73 commented Oct 2, 2025

Copy link
Copy Markdown

Migration to v19.0

  • Update the module version from 18.0.1.0.0 to 19.0.1.0.0.

Technical changes

  • Change of the version field in the manifest to ‘19.0.1.0.0’.
  • Replaced the SQL constraint _sql_constraints with the new syntax models.Constraint(‘UNIQUE(name)’, ...).
  • Correction of attribute calls in the request context (e.g. request.env.uid instead of request.uid).
  • Updated the use of translation functions, changing from _() to self.env._() with modernised parameter formatting.
  • Removed a pylint comment for the jwt dependency.
  • In the test file, the search for an existing partner was replaced by the explicit creation of a test partner.

Changes to exceptions

  • Improved the format of error messages to use the new translation system with placeholders.

@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-auth_jwt branch 2 times, most recently from c958190 to 0e1ad1d Compare October 2, 2025 08:47
@pablo-cort-s73 pablo-cort-s73 mentioned this pull request Oct 2, 2025
19 tasks
@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot migration auth_jwt

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Oct 2, 2025

@sbidoul sbidoul left a comment

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.

Thanks for this migration! Looks good, just a minor comment.

I mark it as change requested, just because it is important to not merge this until we are sure that the tests in auth_jwt_demo pass too (this was forgotten in 17 and 18). Would you like to migrate it too, starting from #846? This migration can be done in this same PR since the modules are so closely related.

Comment thread auth_jwt/models/auth_jwt_validator.py Outdated
if not validators:
break
validators._register_auth_method()
offset += BATCH_SIZE

@sbidoul sbidoul Oct 9, 2025

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 not worth the added complexitty. In this case we know that there will never be thousands of validators so search([]) is fine. Let's silence the pylint warning instead # pylint: disable=... on the search line.

@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-auth_jwt branch 7 times, most recently from 809c82b to ff1ee24 Compare October 13, 2025 08:17
@pablo-cort-s73

Copy link
Copy Markdown
Author

Thanks for this migration! Looks good, just a minor comment.

I mark it as change requested, just because it is important to not merge this until we are sure that the tests in auth_jwt_demo pass too (this was forgotten in 17 and 18). Would you like to migrate it too, starting from #846? This migration can be done in this same PR since the modules are so closely related.

Hello @sbidoul , I have migrated the demo module, but it seems that it does not load the demo data in the tests, since in the first test where it checks if the validator exists, it no longer finds it.
I have tried to replicate it locally and have managed to do so by manually loading the demo data from the Odoo settings, but not by initialising the auth_jwt_demo module.
Do you know why it is not loading in the OCA tests?

Best regards,

@sbidoul

sbidoul commented Oct 13, 2025

Copy link
Copy Markdown
Member

Indeed Odoo 19 does not load demo data by default. The general thinking is that this is a good thing and that tests should work independently of demo data. It makes sense to me that tests should not depend on demo data of other modules, but I kind of think depending on demo data of the module itself is okay.

I'm not sure what to do with that here yet. I'll need to look closer.

Ah, I see you have tried to make the linter happy on the js lib. But since that one is copied from elsewhere, it's better to keep it untouched and exclude it in .pre-commit-config.yaml like I did in 9762fdf.

@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-auth_jwt branch 2 times, most recently from a8ff3c0 to cafd0d9 Compare October 13, 2025 09:18
@pablo-cort-s73

Copy link
Copy Markdown
Author

Hello @sbidoul, have you seen or do you know how we can launch the demo data for the tests?
Can the demo data be launched from the test setup in this case?

@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-auth_jwt branch 11 times, most recently from 0234962 to 205e0c8 Compare November 10, 2025 11:59
@pablo-cort-s73 pablo-cort-s73 force-pushed the 19.0-mig-auth_jwt branch 3 times, most recently from ccaea80 to 770b6da Compare April 13, 2026 07:47
@pablo-cort-s73

Copy link
Copy Markdown
Author

@sbidoul can you review, pls?
thanks

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.