Mercado Libre Connector

Connect an Odoo company to a Mercado Libre seller account.
This is the core of the connector. It stores the seller backend,
authorizes the application with OAuth 2.0, refreshes access tokens, and
receives Mercado Libre notifications. Listing, stock, and sale
synchronization live in connector_mercadolibre_product and
connector_mercadolibre_sale.
A notification is stored and acknowledged in the HTTP request. The work
runs afterwards in an OCA queue job.
Important
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
More details on development status
Table of contents
Install this module together with OCA connector 19.0. connector
depends on component, component_event, and queue_job.
The HTTP client uses the Python package requests.
Enable the job runner. In odoo.conf:
[queue_job]
channels = root:2,root.mercadolibre.import:2,root.mercadolibre.export:1,root.mercadolibre.webhook:2
Start Odoo with --load=base,web,queue_job and more than one worker.
- Create an application in Mercado Libre (My Applications) with write
scope and a redirect URI that points at this database, for example
https://example.com/mercadolibre/oauth/callback.
- Set the notification callback to
https://example.com/mercadolibre/notification/<backend-database-id>.
Subscribe the topics the installed addons handle. The core stores
every topic; product and sale addons consume items,
stock-location, orders_v2, shipments, and payments.
- Grant operators Mercado Libre / User and administrators Mercado
Libre / Manager.
- Open Mercado Libre / Configuration / Backends, create a backend,
set the company, the site (MLA, MLB, MLM, …), the client
id, the client secret, and the redirect URI.
- Click Connect and authorize the seller. The backend stores the
seller id returned by /users/me and the token pair.
- A scheduled action refreshes the access token before the six-hour
expiry. When Mercado Libre rejects the refresh token, the backend
moves to Error and an administrator reconnects the seller.
Open Mercado Libre / Operations / Notifications to see the callbacks
Mercado Libre has posted. Each row is dispatched by a job on the
root.mercadolibre.webhook channel.
A topic with no installed handler is marked Skipped. Installing a
later addon adds a handler component; the controller stays unchanged.
Refresh token on the backend asks Mercado Libre for a new access
token immediately. Disconnect deletes the stored tokens.
The backend model mercadolibre.backend is the component collection.
Dispatch loads every component with usage notification.handler on
mercadolibre.notification and keeps the one whose _topic equals
the payload topic. A handler with an empty _topic marks the
notification skipped.
_apply_on has to be an Odoo model name. The Mercado Libre topic is
not a model, so a later addon selects its topic with _topic.
Register a handler for one topic in another addon:
class OrderNotificationHandler(Component):
_name = "mercadolibre.notification.handler.orders"
_inherit = "mercadolibre.notification.handler"
_apply_on = "mercadolibre.notification"
_usage = "notification.handler"
_topic = "orders_v2"
def handle(self):
notification = self.work.notification
...
The HTTP adapter usage is backend.adapter. Child adapters inherit
mercadolibre.adapter and set the resource path. Token refresh takes
a row lock on the backend because the refresh token is single-use.
Set QUEUE_JOB__NO_DELAY=1 to run jobs inline while developing.
- connector_mercadolibre_product binds listings and exports price
and seller-warehouse stock.
- connector_mercadolibre_sale imports orders, packs, and shipments.
- Questions, claims, shipping labels, promotions, payouts, country
fiscal documents, and Global Selling (/marketplace) are further
addons. Each one adds components and does not change this controller.
Bugs are tracked on GitHub 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.
Do not contact contributors directly about support or help with technical issues.
This module is maintained by the OCA.
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.
Current maintainer:

This module is part of the OCA/connector-mercadolibre project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.