Skip to content

Conversation

@GuillemCForgeFlow
Copy link

Based on OCA/edi#1059, first added in the edi repository, now adding both the endpoint & endpoint_route_handler base modules here just as done in upper versions.

cc @ForgeFlow

simahawk and others added 30 commits November 7, 2024 15:36
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.
Depending on your modules inheritance and upgrade order
when you introduce this mixin on an existing model
it might happen that
gets called before the model's table is ready
(eg: another odoo service loading the env before the upgrade happens).
Let if fail gracefully since the hook will be called again later.
As routes are registered automatically in the db after sync
there's no reason to look for non registered routes at boot.
Furthermore, this is causing access conflicts on the table
when multiple instances w/ multiple workers are spawned.
oca-ci and others added 21 commits November 7, 2024 15:49
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-api-14.0/web-api-14.0-endpoint
Translate-URL: https://translation.odoo-community.org/projects/web-api-14-0/web-api-14-0-endpoint/
Very handy especially to log errors w/o providing much info to the caller.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-api-14.0/web-api-14.0-endpoint
Translate-URL: https://translation.odoo-community.org/projects/web-api-14-0/web-api-14-0-endpoint/
As the mixin can be inherited by many other models w/ their view
an isolated basic view is required to avoid pollution and breakage
of inherited views when extending the views of endpoint.endpoint.

In particular, this solves a conflict that came w/ OCA/web-api-contrib#1
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: web-api-14.0/web-api-14.0-endpoint
Translate-URL: https://translation.odoo-community.org/projects/web-api-14-0/web-api-14-0-endpoint/
@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 16, 2025
@github-actions github-actions bot closed this Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants