Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
a514dbc
Draft new component_event addon
Jun 17, 2017
4928ebb
Hold a component registry per database
Jun 17, 2017
93d7370
Add cache in component_event
Jun 18, 2017
4280da6
Complete component_event
Jun 19, 2017
316a137
Prevent trigger of events before registry is ready
Jun 19, 2017
a409ad5
Fix test: post_install
Jun 19, 2017
43bfde1
Move base component in a components directory
Jun 20, 2017
fe9e3ce
Check that component registry is ready for events
Jun 20, 2017
6d55939
Ignore W0104 pylint warnings in tests
Jun 20, 2017
78ed28d
Remove doc about creating abstract listener
Jun 20, 2017
d6c6ddb
Correct event name in doc and add signature
Jun 21, 2017
46c04ca
Remove RecordsEventListener
Jun 21, 2017
0cb363e
Add @skip_if decorator to skip events
Jun 22, 2017
2c729e0
Notify unlink event before the unlink
Jun 22, 2017
3aa174c
Simplify tests by loading modules components
Jun 30, 2017
2bac3ad
Remove model_name in _event()
Jun 30, 2017
2d7f142
Add readme files
Jul 11, 2017
4a9e30c
Fix cache of events
Jul 17, 2017
4987de8
[IMP] component_event: Document implemented events
lasley Aug 30, 2017
0473d01
[FIX] component_event: Link to pre-existing docs for model events
lasley Aug 30, 2017
4e4cb63
[MIG] Set modules uninstallable
Oct 3, 2017
044d54d
Make addons installable
Oct 3, 2017
873f42a
PY3: apply automated changes by 2to3 on addons
Oct 3, 2017
297009d
Fix some pylint-odoo warnings
Oct 3, 2017
c961395
OCA Transbot updated translations from Transifex
oca-transbot Feb 17, 2018
b8a8cd6
Improve documentation of APIs
Mar 30, 2018
355a0e8
[MIG] Make modules uninstallable
OCA-git-bot Sep 26, 2018
c4e8dbc
Migrate component_event to 12.0
Nov 26, 2018
2d46d22
component, component_event: tag unittest.TestCase subclasses
naglis Mar 19, 2019
20a5fb5
Fix compatibility with cachetools 3.0.0
Apr 12, 2019
675f7fa
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
7fe2938
Set modules uninstallable
Oct 10, 2019
65ec203
[MIG] component_event: Migration to 13.0
damdam-s Oct 11, 2019
f1bd9c3
[MIG] test_component: Migration to 13.0
damdam-s Oct 11, 2019
c9e326d
[12.0][CHG] connector: Use more permissive licence: AGPL-> LGPL
lmignon Oct 14, 2019
663909d
black, isort
lmignon Oct 23, 2019
82454e2
[MIG] component, component_event, test_component: Installable True
lmignon Oct 23, 2019
ea2b60c
Recover the v13 new feature of create method with a list of vals on Base
jbaudoux May 25, 2020
546b42b
component_event: 13.0.1.0.1
May 26, 2020
c301fd8
MIGR 14.0 component_event
bealdav Oct 12, 2020
91342ff
FIX component: add py3.8 backport to make test right
bealdav Oct 26, 2020
19c879f
component_event 14.0.1.0.1
OCA-git-bot Dec 12, 2020
817e340
component_event: allow propagation of custom registry
simahawk Nov 5, 2020
8bbc9ce
component_event: adapt test class usage
simahawk Nov 9, 2020
a695f71
component_event 14.0.1.0.2
OCA-git-bot Jan 4, 2021
03c112b
Initialize 15.0 branch
lmignon Nov 25, 2021
460007e
[MIG][15.0] component_event
i-vyshnevska Dec 2, 2021
676ff85
[MIG][15.0] test_connector
i-vyshnevska Dec 2, 2021
d2693ac
[REF] remove explicit 'object' inheritance
florentx Jan 27, 2022
5d356a4
component_event 15.0.1.0.1
OCA-git-bot Aug 1, 2022
2a3672e
[16.0][MIG] component_event: Migration to 16.0
asierneiradev Sep 28, 2022
7755b27
Update translation files
weblate Feb 2, 2023
0dff37b
component_event: fix test class
simahawk Mar 2, 2023
42c8df8
component_event 16.0.1.0.1
OCA-git-bot Mar 2, 2023
1bec400
Added translation using Weblate (Spanish)
Ivorra78 Aug 2, 2023
509b1ab
[IMP] component_event: black, isort, prettier
nguyenminhchien Nov 23, 2023
d076e77
[MIG] component_event: Migration to 17.0
nguyenminhchien Dec 8, 2023
4f7762b
Added translation using Weblate (Italian)
mymage Feb 4, 2024
3b3f574
[MIG] component_event: Migration to 18.0
thienvh332 Sep 19, 2024
b2d7d15
[IMP] component_event: pre-commit auto fixes
yankinmax Apr 6, 2026
ac63890
[MIG] component_event Migration to 19.0
Sanazzzmi Oct 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions component_event/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================
Components Events
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:97bef8a6c3971c475f2ebe58ebed781490658d2174669d49ee22cea9869fc0a0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fconnector-lightgray.png?logo=github
:target: https://github.com/OCA/connector/tree/19.0/component_event
:alt: OCA/connector
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/connector-19-0/connector-19-0-component_event
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/connector&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module implements an event system (`Observer
pattern <https://en.wikipedia.org/wiki/Observer_pattern>`__) and is a
base block for the Connector Framework. It can be used without using the
full Connector though. It is built upon the ``component`` module.

Documentation: http://odoo-connector.com/

**Table of contents**

.. contents::
:local:

Usage
=====

As a developer, you have access to a events system. You can find the
documentation in the code or on http://odoo-connector.com

In a nutshell, you can create trigger events:

::

class Base(models.AbstractModel):
_inherit = 'base'

@api.model
def create(self, vals):
record = super(Base, self).create(vals)
self._event('on_record_create').notify(record, fields=vals.keys())
return record

And subscribe listeners to the events:

::

from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if

class MagentoListener(Component):
_name = 'magento.event.listener'
_inherit = 'base.connector.listener'

@skip_if(lambda self, record, **kwargs: self.no_connector_export(record))
def on_record_create(self, record, fields=None):
""" Called when a record is created """
record.with_delay().export_record(fields=fields)

This module triggers 3 events:

- ``on_record_create(record, fields=None)``
- ``on_record_write(record, fields=None)``
- ``on_record_unlink(record)``

Changelog
=========

Next
----

12.0.1.0.0 (2018-11-26)
-----------------------

- [MIGRATION] from 12.0 branched at rev. 324e006

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/connector/issues/new?body=module:%20component_event%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Camptocamp

Contributors
------------

- Guewen Baconnier <guewen.baconnier@camptocamp.com>

Other credits
-------------



Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/connector <https://github.com/OCA/connector/tree/19.0/component_event>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 6 additions & 0 deletions component_event/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from . import core
from . import components
from . import models

# allow public API 'from odoo.addons.component_event import skip_if'
from .components.event import skip_if # noqa
15 changes: 15 additions & 0 deletions component_event/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)

{
"name": "Components Events",
"version": "19.0.1.0.0",
"author": "Camptocamp,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/connector",
"license": "LGPL-3",
"category": "Generic Modules",
"depends": ["component"],
"external_dependencies": {"python": ["cachetools"]},
"data": [],
"installable": True,
}
1 change: 1 addition & 0 deletions component_event/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import event
Loading
Loading