Search 1.9 billion lines of Odoo code on GitHub

component_event

Author: Camptocamp,Odoo Community Association (OCA)
License: LGPL-3
Branch: 15.0
Repository: aurestic/connector
Dependencies: component
Languages: HTML (383, 35.5%), PO File (30, 2.8%), Python (568, 52.6%), and reStructuredText (99, 9.2%)
Other branches: 10.0, 11.0, 12.0, 13.0, 14.0, and 16.0
Other repositories: 001101/connector, App247/connector, BahaDuganov/connector, Bubbles-IT/connector, CGenie/connector, Change2improve/connector, ChinaShrimp/connector, ClancyQiao/connector, ClearCorp/oca-connector, Comunitea/connector, DITIntl/connector, DarioLodeiros/connector, Decikingship/connector, Digital5-Odoo/connector, Djaitai/connector, DjaitaiKoffi/connector, ERPLibre/connector, Elico-Corp/connector, Emadbox/connector, ForgeFlow/connector, GrupoAlvamex/connector, ImCowboySibs/connector, Ingeos/connector, IoTGates/connector, Jarsa/connector, Jeisonpernia/connector, JoJoJoJoJoJoJo/connector, Karsten-77/connector, KolushovAlexandr/connector, Mainframed69/connector, MediaJockey/connector, Miller-Media/connector, OCA/connector, OdooIndonesia/connector, OpenAT/connector, Reinhard-sheng/connector, RosleStores/connector, SeuMarco/connector, Stanadigme/connector, Stefano7777777/connector, StephanRozendaal/connector, TRESCLOUD/connector, Tecnativa/connector, VCLS-org/connector, VanMoof/connector, Vauxoo/connector, VisiionSolucionesTecnologicas/connector, YogeshMahera-SerpentCS/connector, YouByPiccadilly/connector, aaltinisik/connector, acsone/connector, agyamuta/connector, akretion/connector, altanmur/connector, amendoncabh/connector, anand-serpentcs/connector, andreinl/connector, andres-mejia/connector, anhvu-sg/connector, ateneolab/connector, avoinsystems/connector, bishalgit/connector, bmya/connector, bobslee/connector, bodedra/connector, brain-tec/connector, brainbeanapps/connector, bvkl/connector, camptocamp/connector, chenjingxiong/connector, chianggq/connector, coopiteasy/connector, damcar/connector, damdam-s/connector, darshan-odoo/connector, desphunter/connector, diagramsoftware/connector, dinamohammed/connector, dingguijin/connector, djangkrix/connector, dong-z/connector, ehsu0407/connector, eillel/connector, elego/connector, enocare/connector, exosoftware/oca-connector, fahadabasheer/connector, fateenvoy/connector, gaanto/connector, gastonfeng/connector, githubcodi/connector, gorozcoh/connector, gtorresemmanuel/connector, guewen/connector, gurneyalex/connector, guwenfeng/connector, haroldtamo/connector, hibou-io/oca-connector, hpatelserpentcs/connector, huntergps/connector, hzwzw/connector, isoscl/connector, it-projects-llc/connector, italoadler/connector, jbaudoux/connector, jcoux/connector, jsilvestar/connector, juanbaez/odoo-connector, judaa11/connector, kenvac/connector, kevin070982/odoo-project-10.0, lideritjnma/connector, ltnil/connector, mfhm95/connector, mikolodz/connector, mohamed-helmy/connector, mozaik-association/connector, mpanarin/connector, noorealam96/connector, odoo-mohsin/connector, omalbastin/connector, pnajman-modoolar/connector, popcomputadores-desenv/connector, pscloud/connector, qtheuret/connector, raofei/connector, robotiko/connector, sadimoodi/connector, sanube/connector, sebalix/connector, sewisoft/connector, simahawk/connector, sschmid-test-org/connector, steingabelgaard/connector, sunshineLhj/connector, thanhnv3690/connector, themreza/connector, ursais/connector, vdedyukhin/connector, versada/connector, vjd8866/connector, weddingjuma/connector, westlyou/connector, x0rzkov/odoo-connector, xwh123807/connector, y2gsmith/connector, yasr3mr96/connector, ychirino/connector, zeroincombenze/connector, and zhaowenzhe/connector

<h1 class="title">Components Events</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/connector/tree/15.0/component_event"><img alt="OCA/connector" src="https://img.shields.io/badge/github-OCA%2Fconnector-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/connector-15-0/connector-15-0-component_event"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/102/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module implements an event system (<a class="reference external" href="https://en.wikipedia.org/wiki/Observer_pattern">Observer pattern</a>) and is a base block for the Connector Framework. It can be used without using the full Connector though. It is built upon the <code>component</code> module.</p> <p>Documentation: <a class="reference external" href="http://odoo-connector.com/">http://odoo-connector.com/</a></p> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id2">Usage</a></li> <li><a class="reference internal" href="#changelog" id="id3">Changelog</a><ul> <li><a class="reference internal" href="#next" id="id4">Next</a></li> <li><a class="reference internal" href="#id1" id="id5">12.0.1.0.0 (2018-11-26)</a></li> </ul> </li> <li><a class="reference internal" href="#bug-tracker" id="id6">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id7">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id8">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id9">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id10">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id2">Usage</a></h2> <p>As a developer, you have access to a events system. You can find the documentation in the code or on <a class="reference external" href="http://odoo-connector.com">http://odoo-connector.com</a></p> <p>In a nutshell, you can create trigger events:</p> <pre> <code>class Base(models.AbstractModel): _inherit = 'base' &#64;api.model def create(self, vals): record = super(Base, self).create(vals) self._event('on_record_create').notify(record, fields=vals.keys()) return record</code> </pre> <p>And subscribe listeners to the events:</p> <pre> <code>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' &#64;skip_if(lambda self, record, **kwargs: self.no_connector_export(record)) def on_record_create(self, record, fields=None): &quot;&quot;&quot; Called when a record is created &quot;&quot;&quot; record.with_delay().export_record(fields=fields)</code> </pre> <p>This module triggers 3 events:</p> <ul class="simple"> <li><code>on_record_create(record, fields=None)</code></li> <li><code>on_record_write(record, fields=None)</code></li> <li><code>on_record_unlink(record)</code></li> </ul> <a name="changelog"></a> <h2><a class="toc-backref" href="#id3">Changelog</a></h2> <a name="next"></a> <h3><a class="toc-backref" href="#id4">Next</a></h3> <a name="id1"></a> <h3><a class="toc-backref" href="#id5">12.0.1.0.0 (2018-11-26)</a></h3> <ul class="simple"> <li>[MIGRATION] from 12.0 branched at rev. 324e006</li> </ul> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id6">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/connector/issues">GitHub Issues</a>. 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 <a class="reference external" href="https://github.com/OCA/connector/issues/new?body=module:%20component_event%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id7">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id8">Authors</a></h3> <ul class="simple"> <li>Camptocamp</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id9">Contributors</a></h3> <ul class="simple"> <li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id10">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>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.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/connector/tree/15.0/component_event">OCA/connector</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>