Skip to content

Conversation

@cormaza
Copy link
Contributor

@cormaza cormaza commented Nov 8, 2024

Supersed #65

Added parameter readonly in route definition, by default false to keep standard behavior

@cormaza cormaza force-pushed the 18.0-mig-endpoint_route_handler branch from 52c406f to 2f0075e Compare November 8, 2024 17:08
@cormaza
Copy link
Contributor Author

cormaza commented Nov 8, 2024

Thanks for this module @simahawk, please let me know if everything is fine

@simahawk
Copy link
Contributor

/ocabot migration endpoint_route_handler

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Nov 20, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Nov 20, 2024
7 tasks
@simahawk
Copy link
Contributor

simahawk commented Nov 20, 2024

Thanks for your work!
LG but I think we miss this PR that is not fwd ported yet to v17 #52
Would you mind porting it to 17 and then cherry-pick the commit here?

@cormaza
Copy link
Contributor Author

cormaza commented Nov 20, 2024

Thanks for your work! LG but I think we miss this PR that is not fwd ported yet to v17 #52 Would you mind porting it to 17 and then cherry-pick the commit here?

I'm no really sure, because in version 16 you have a class method, then in 17 version is a regular function, maybe we can include after forward ported to 17 version I can include in this MR, wdyt?

@simahawk
Copy link
Contributor

Sure, we have to port all changes to v17 first. You can try https://github.com/OCA/oca-port 😉

@simahawk
Copy link
Contributor

And there's a fix for it that just landed in 16 #77

simahawk and others added 18 commits December 23, 2024 11:51
When an endpoint is archived it must be dropped.
When it's unarchive it must be restored.
Routing maps are generated **per env**
which means that every new env will have its own routing map
attached to `ir.http` registry class.

This is not desired (as per core Odoo comment)
but it's like this today :/

Hence, before this change, the routing map could be mis-aligned
across different envs leading to random responses for custom endpoints.

This refactoring simplifies a lot the handling of the rules
leaving to std `_generate_routing_rules` the duty to yield rules
and to `routing_map` to generate them for the new route map.

EndpointRegistry memory consumption is improved too
thanks to smaller data to store and to the usage of __slots__.
To avoid multiple invalidation of all envs on each edit or create
of persistent records, a new flag is introduced: 'registry_sync'.

This flag delays the sync of the rule registry till manual action
occurs. Records in the UI are decorated accordingly to notify users of
the need to reflect changes on ther registry to make them effective.

The sync happens in a post commit hook to ensure all values are in place
for the affected records.
@cormaza cormaza force-pushed the 18.0-mig-endpoint_route_handler branch from 2f0075e to 31582b3 Compare December 23, 2024 16:51
@JordiMForgeFlow JordiMForgeFlow mentioned this pull request Jan 15, 2025
1 task
Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

I'd like to get rid of the .tool as I've found an alternative but I don't have time to provide specs now... and this is blocking other modules.
Thanks!

@simahawk
Copy link
Contributor

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 18.0-ocabot-merge-pr-69-by-simahawk-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit d127aa6 into OCA:18.0 Jan 30, 2025
5 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

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

@simahawk
Copy link
Contributor

simahawk commented Jul 16, 2025

FYI for existing records you must force sync otherwise the new param readonly won't be stored and the endpoint will be broken.
Here are specific fixes for depending modules:

#105
OCA/edi-framework#184

Manual work around:

  1. archive
  2. sync
  3. unarchive
  4. sync

@lmignon maybe you need that for existing fastapi.endpoint too

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants