Search 1.9 billion lines of Odoo code on GitHub

component_event

Author: Camptocamp,Odoo Community Association (OCA)
License: LGPL-3
Branch: 10.0
Repository: aurestic/connector
Dependencies: component
Languages: PO File (30, 4.8%), Python (531, 85.4%), and reStructuredText (61, 9.8%)
Other branches: 11.0, 12.0, 13.0, 14.0, 15.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

<a class="reference external image-reference" 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.svg"> </a> <a name="components-events"></a> <h2>Components - Events</h2> <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> <a name="installation"></a> <h3>Installation</h3> <ul class="simple"> <li>Install <code>component_event</code></li> </ul> <a name="configuration"></a> <h3>Configuration</h3> <p>The module does nothing by itself and has no configuration.</p> <a name="usage"></a> <h3>Usage</h3> <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="bug-tracker"></a> <h3>Bug Tracker</h3> <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 smash it by providing detailed and welcomed feedback.</p> <a name="credits"></a> <h3>Credits</h3> <a name="images"></a> <h4>Images</h4> <ul class="simple"> <li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li> </ul> <a name="contributors"></a> <h4>Contributors</h4> <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> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="maintainer"></a> <h4>Maintainer</h4> <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>This module is maintained by the OCA.</p> <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>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>