Skip to content

[19.0][MIG] component_event: Migration to 19.0#526

Merged
OCA-git-bot merged 61 commits into
OCA:19.0from
camptocamp:19.0-mig-component_event
Apr 20, 2026
Merged

[19.0][MIG] component_event: Migration to 19.0#526
OCA-git-bot merged 61 commits into
OCA:19.0from
camptocamp:19.0-mig-component_event

Conversation

@yankinmax
Copy link
Copy Markdown
Contributor

Standard migration.

Depends on:

This PR is opened to speed up migration to 19.0.

@yankinmax yankinmax force-pushed the 19.0-mig-component_event branch from 062ae17 to d8bc76d Compare April 6, 2026 08:40
@ivantodorovich
Copy link
Copy Markdown
Contributor

ivantodorovich commented Apr 6, 2026

Copy link
Copy Markdown

@vvrossem vvrossem left a comment

Choose a reason for hiding this comment

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

Migration commit LG

Copy link
Copy Markdown

@JordiMForgeFlow JordiMForgeFlow left a comment

Choose a reason for hiding this comment

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

functionally tested

@yankinmax yankinmax force-pushed the 19.0-mig-component_event branch from d8bc76d to e848292 Compare April 20, 2026 10:31
@OCA-git-bot OCA-git-bot added mod:component Module component mod:component_event Module component_event series:19.0 labels Apr 20, 2026
Guewen Baconnier added 17 commits April 20, 2026 13:31
Proposing a new API based on components for the events
Because they can have different addons
So we don't need to iterate on the listeners to find the events each
time the event is triggered.

* rename producer -> collecter, which is more accurate regarding what it does
* rename the trigger function 'fire' -> 'notify', just a matter of
  preference here :)
* add a CollectedEvents class so we don't modify the state of the
collecter and we don't mix responsibilities
* Add documentation
* Add a few more test cases
* Prevent using component lookup methods from an EventWorkContext when
  there is no collection, but allow to switch to a WorkContext with
  collection
* Increase cache size (should be measured at some point...)
* Fix a few issues with collection being an empty model being False-ish,
  so added comparisons with None
* Add abstract Component with the base events (on_record_create,
  on_record_write, on_record_unlink)
We return an empty list of events so nothing is triggered
Tests using odoo transactions must run post install, because during the
install the registry is not ready, so the components aren't neither.
For consistency, this is where components should go (as for models,
views, ...)
Checking that the odoo registry is ready is not working:
in tests, the events are not working because they are run
just before the odoo registry is set to ready.
I'm not sure it is good actually. If you inherit from it for only one of
the method, the other methods will listen be executed for doing nothing,
but that's still a useless call of method...
It's not really usable: if we inherit from it and implement only one
method, the others will be called without effect, waste of resources
It takes a condition which skip the event when evaluated to True.
A new base listener for the connector adds a default condition based on
self.env.context.get('connector_no_export'). Every export event listener
should be decorated with:

    @skip_if(lambda self, *args, **kwargs: self.no_connector_export)
Otherwise we can't read the record
It the previous commit, @lmignon added the possibility to load all
components of an addon in a Component Registry.  This commit takes
benefit of this feature to simplify the existing tests and to add a base
test case for the Connector (that loads all components of 'component',
'component_event', 'connector'). It can be used in implementations using
the connector.
It is unused, and depends on the model on which we call it
@yankinmax yankinmax force-pushed the 19.0-mig-component_event branch from e848292 to 241819d Compare April 20, 2026 10:32
@OCA-git-bot OCA-git-bot removed the mod:component Module component label Apr 20, 2026
@yankinmax yankinmax force-pushed the 19.0-mig-component_event branch from 241819d to ac63890 Compare April 20, 2026 10:33
@yankinmax
Copy link
Copy Markdown
Contributor Author

Hello @guewen can you pls take a look at this migration PR and possibly trigger merge?

Copy link
Copy Markdown
Member

@guewen guewen left a comment

Choose a reason for hiding this comment

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

/ocabot merge nobump

Thanks

@OCA-git-bot
Copy link
Copy Markdown
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 19.0-ocabot-merge-pr-526-by-guewen-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 696a3da into OCA:19.0 Apr 20, 2026
5 of 7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at cb9a498. 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.