Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] component_event: Migration to 16.0 #443

Merged
merged 65 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
25be83d
Draft new component_event addon
guewen Jun 17, 2017
e81e348
Hold a component registry per database
guewen Jun 17, 2017
35d3dac
Add cache in component_event
guewen Jun 18, 2017
a8b499f
Complete component_event
guewen Jun 19, 2017
b2da653
Prevent trigger of events before registry is ready
guewen Jun 19, 2017
be4272c
Fix test: post_install
guewen Jun 19, 2017
a4168a4
Move base component in a components directory
guewen Jun 20, 2017
7bbf802
Check that component registry is ready for events
guewen Jun 20, 2017
fe43970
Ignore W0104 pylint warnings in tests
guewen Jun 20, 2017
80c7757
Remove doc about creating abstract listener
guewen Jun 20, 2017
91a2afb
Correct event name in doc and add signature
guewen Jun 21, 2017
c16c77e
Remove RecordsEventListener
guewen Jun 21, 2017
edc267c
Add @skip_if decorator to skip events
guewen Jun 22, 2017
ae0950e
Notify unlink event before the unlink
guewen Jun 22, 2017
9804bc7
Simplify tests by loading modules components
guewen Jun 30, 2017
78f6f13
Remove model_name in _event()
guewen Jun 30, 2017
e2cd42f
Add readme files
guewen Jul 11, 2017
06c0f25
Fix cache of events
guewen Jul 17, 2017
6aebe16
[IMP] component_event: Document implemented events
lasley Aug 30, 2017
6fb1a95
[FIX] component_event: Link to pre-existing docs for model events
lasley Aug 30, 2017
30f2e30
[MIG] Set modules uninstallable
guewen Oct 3, 2017
c63a246
Make addons installable
guewen Oct 3, 2017
fe42924
PY3: apply automated changes by 2to3 on addons
guewen Oct 3, 2017
a5c6c96
Fix some pylint-odoo warnings
guewen Oct 3, 2017
3c25298
OCA Transbot updated translations from Transifex
oca-transbot Feb 17, 2018
04bf49d
[UPD] Update component_event.pot
oca-travis Jun 23, 2018
97287dd
Improve documentation of APIs
guewen Mar 30, 2018
4f07591
[MIG] Make modules uninstallable
OCA-git-bot Sep 26, 2018
ba10d9e
Migrate component_event to 12.0
guewen Nov 26, 2018
641f054
[UPD] README.rst
OCA-git-bot Jan 14, 2019
8024102
[UPD] Update component_event.pot
oca-travis Jan 14, 2019
65acf3c
Update translation files
oca-transbot Jan 27, 2019
af9c236
component, component_event: tag unittest.TestCase subclasses
naglis Mar 19, 2019
27529ca
[ADD] icon.png
OCA-git-bot Apr 3, 2019
cddadc3
Fix compatibility with cachetools 3.0.0
guewen Apr 12, 2019
8942cc4
[UPD] README.rst
OCA-git-bot Jul 29, 2019
5d8922d
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
d3a2591
Translated using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
22a47b4
Set modules uninstallable
guewen Oct 10, 2019
a89e02a
[MIG] component_event: Migration to 13.0
damdam-s Oct 11, 2019
af612ea
[MIG] test_component: Migration to 13.0
damdam-s Oct 11, 2019
5898127
[12.0][CHG] connector: Use more permissive licence: AGPL-> LGPL
lmignon Oct 14, 2019
a83e1ee
black, isort
lmignon Oct 23, 2019
bfb0902
[MIG] component, component_event, test_component: Installable True
lmignon Oct 23, 2019
5131102
[UPD] Update component_event.pot
oca-travis Oct 30, 2019
500f5ca
[UPD] README.rst
OCA-git-bot Oct 30, 2019
e1b83e2
Recover the v13 new feature of create method with a list of vals on Base
jbaudoux May 25, 2020
21af8c1
component_event: 13.0.1.0.1
guewen May 26, 2020
86910e3
MIGR 14.0 component_event
bealdav Oct 12, 2020
e514abd
FIX component: add py3.8 backport to make test right
bealdav Oct 26, 2020
b617b4e
[UPD] Update component_event.pot
oca-travis Oct 26, 2020
dd4fd72
[UPD] README.rst
OCA-git-bot Oct 26, 2020
73467a5
[IMP] update dotfiles
OCA-git-bot Dec 12, 2020
dd2ddbd
component_event 14.0.1.0.1
OCA-git-bot Dec 12, 2020
0bebc98
component_event: allow propagation of custom registry
simahawk Nov 5, 2020
d984a0e
component_event: adapt test class usage
simahawk Nov 9, 2020
af7ab56
component_event 14.0.1.0.2
OCA-git-bot Jan 4, 2021
179c91c
Initialize 15.0 branch
lmignon Nov 25, 2021
0da3911
[MIG][15.0] component_event
i-vyshnevska Dec 2, 2021
20b5458
[MIG][15.0] test_connector
i-vyshnevska Dec 2, 2021
dfce881
[UPD] Update component_event.pot
Jan 25, 2022
e52d1ef
[UPD] README.rst
OCA-git-bot Jan 25, 2022
3f00b62
[REF] remove explicit 'object' inheritance
florentx Jan 27, 2022
3477423
component_event 15.0.1.0.1
OCA-git-bot Aug 1, 2022
362eaf6
[16.0][MIG] component_event: Migration to 16.0
asierneiradev Sep 28, 2022
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
138 changes: 138 additions & 0 deletions component_event/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
=================
Components Events
=================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/licence-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/16.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-16-0/connector-16-0-component_event
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/102/16.0
:alt: Try me on Runbot

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

This module implements an event system (`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/

.. _Observer pattern: https://en.wikipedia.org/wiki/Observer_pattern

**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
=========

.. [ The change log. The goal of this file is to help readers
understand changes between version. The primary audience is
end users and integrators. Purely technical changes such as
code refactoring must not be mentioned here.

This file may contain ONE level of section titles, underlined
with the ~ (tilde) character. Other section markers are
forbidden and will likely break the structure of the README.rst
or other documents where this fragment is included. ]

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/connector/issues/new?body=module:%20component_event%0Aversion:%2016.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 <[email protected]>

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/16.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": "16.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