<commit_before>.. _bootstrap-connector:


########################
Boostrapping a connector
########################

We'll see the steps to bootstrap a new connector.

Besides that, you may want to use the existing connectors to have some
real implementation examples:

* Magentoerpconnect_
* Prestashoperpconnect_

Some boilerplate is necessary, so this document will guide you through
some steps.

For the sake of the example, we'll imagine we have to synchronize
OpenERP with a coffee machine.

****************
OpenERP Manifest
****************

As we want to synchronize OpenERP with a coffee machine, we'll name
our connector connector_coffee.

First, we need to create the OpenERP addons itself, editing the
``connector_coffee/__openerp__.py`` manifest.


.. code-block:: python
   :emphasize-lines: 4,5

    # -*- coding: utf-8 -*-
    {'name': 'Coffee Connector',
     'version': '1.0.0',
     'category': 'Connector',
     'depends': ['connector',
                 ],
     'author': 'Myself',
     'license': 'AGPL-3',
     'description': """
    Coffee Connector
    ================

    Connect OpenERP to my coffee machine.

    Features:

    * Poor a coffee when OpenERP is busy for too long
    """,
     'data': [],
     'installable': True,
     'application': False,
    }

Nothing special but 2 things to note:

* It depends from ``connector``.
* The module category should be ``Connector``.

Of course, we also need to create the ``__init__.py`` file where we will
put the imports of our python modules.


***********************************
Install the module in the connector
***********************************

Each new module needs to be plugged in the connector's framework.
That's just a matter of following a convention and creating
``connector_coffee/connector.py`` in which you will call the
``install_connector_module`` function::

    from openerp.addons.connector.connector import install_connector_module


    install_connector_module()

.. warning:: If you miss this line of code, your custom ConnectorUnit
             classes won't be used.
<commit_msg>[CHG] improve a sentence in the documentation<commit_after>.. _bootstrap-connector:


########################
Boostrapping a connector
########################

We'll see the steps to bootstrap a new connector.

Besides that, you may want to use the existing connectors to have some
real implementation examples:

* Magentoerpconnect_
* Prestashoperpconnect_

Some boilerplate is necessary, so this document will guide you through
some steps.

For the sake of the example, we'll imagine we have to synchronize
OpenERP with a coffee machine.

****************
OpenERP Manifest
****************

As we want to synchronize OpenERP with a coffee machine, we'll name
our connector connector_coffee.

First, we need to create the OpenERP addons itself, editing the
``connector_coffee/__openerp__.py`` manifest.


.. code-block:: python
   :emphasize-lines: 4,5

    # -*- coding: utf-8 -*-
    {'name': 'Coffee Connector',
     'version': '1.0.0',
     'category': 'Connector',
     'depends': ['connector',
                 ],
     'author': 'Myself',
     'license': 'AGPL-3',
     'description': """
    Coffee Connector
    ================

    Connect OpenERP to my coffee machine.

    Features:

    * Poor a coffee when OpenERP is busy for too long
    """,
     'data': [],
     'installable': True,
     'application': False,
    }

Nothing special but 2 things to note:

* It depends from ``connector``.
* The module category should be ``Connector``.

Of course, we also need to create the ``__init__.py`` file where we will
put the imports of our python modules.


***********************************
Install the module in the connector
***********************************

Each new module needs to be plugged in the connector's framework.
That's just a matter of following a convention and creating
``connector_coffee/connector.py`` in which you will call the
``install_connector_module`` function::

    from openerp.addons.connector.connector import install_connector_module


    install_connector_module()

.. warning:: If you miss this line of code, your ConnectorUnit classes won't
             be found.

{'fraction_non_alphanumeric': 0.15804461319411486, 'fraction_numerical': 0.0037968675842429997, 'mean_word_length': 3.8116438356164384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5097762', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1103, 'n_words': 463}