Metadata-Version: 2.1
Name: odoo-addon-connector_mercadolibre_sale
Version: 19.0.1.0.0.2
Requires-Dist: odoo-addon-connector_mercadolibre_product==19.0.*
Requires-Dist: odoo-addon-sale_automatic_workflow==19.0.*
Requires-Dist: odoo-addon-sale_automatic_workflow_job==19.0.*
Requires-Dist: odoo-addon-sale_exception==19.0.*
Requires-Dist: odoo==19.0.*
Summary: Orders, packs, and shipments from Mercado Libre
Home-page: https://github.com/OCA/connector-mercadolibre
License: AGPL-3
Author: Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 19.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Development Status :: 3 - Alpha
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

===============================
Mercado Libre Connector - Sales
===============================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:9d62b27086b281bf38bb770190d3d569c5585048fa401ff4e39a4ba17b46a85a
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
    :target: https://odoo-community.org/page/development-status
    :alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fconnector--mercadolibre-lightgray.png?logo=github
    :target: https://github.com/OCA/connector-mercadolibre/tree/19.0/connector_mercadolibre_sale
    :alt: OCA/connector-mercadolibre
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/connector-mercadolibre-19-0/connector-mercadolibre-19-0-connector_mercadolibre_sale
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/connector-mercadolibre&target_branch=19.0
    :alt: Try me on Runboat

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

Import Mercado Libre orders, cart packs, and shipments into Odoo.

One Mercado Libre order becomes one sales order. Orders that share a
pack id stay linked. Shipment status is stored on its own binding and
linked to the delivery when one exists. Paid orders stay in draft and
enter the automatic workflow configured on the backend.

.. 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 <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
   :local:

Installation
============

Install ``connector_mercadolibre_product`` first, then this module.

This module also depends on ``sale_stock``, ``delivery``,
``stock_delivery``, ``sale_automatic_workflow``,
``sale_automatic_workflow_job``, and ``sale_exception``.

Configuration
=============

1. Open the Mercado Libre backend and the page **Sales**.
2. Choose an **Automatic Workflow**. **Import orders** stays available
   only when a workflow is set. Confirmation, invoicing, and delivery
   validation stay in ``sale_automatic_workflow``.
3. Set the sales team and the fiscal position copied onto imported
   orders.
4. Choose service products for the shipping cost and the marketplace
   fee.
5. Optionally set a tracking carrier. Tracking numbers are exported only
   for the seller-provided modes ``custom`` and ``me1``.
6. Map seller warehouses on the **Catalog** page before enabling
   **Export stock**. An unmapped seller logistic type (``drop_off``,
   ``xd_drop_off``, ``cross_docking``, ``self_service``) raises a sale
   exception. Fulfillment stock is never pushed.

Usage
=====

Paid orders import as draft sales orders and take the automatic workflow
from the backend. A cart is several sales orders with the same pack id.
The **Pack** smart button opens the other orders.

A missing SKU is a note on the sales order. The exception **Mercado
Libre missing SKU** blocks confirmation until the listing is matched and
the order is imported again.

Cancelling a Mercado Libre order cancels that sales order when no
delivery is done. The other orders in the pack are left as they are.

Shipment notifications update the shipment binding. A done delivery on a
``custom`` or ``me1`` shipment enqueues one tracking export. ``me2`` and
fulfillment shipments store the tracking number and do not send one.

A payments notification updates the payment status of the existing
order. It does not create a second sales order.

The reconciliation cron and a repeated ``orders_v2`` notification share
one import job per order.

Development
===========

Handlers set ``_topic`` to ``orders_v2``, ``shipments``, or ``payments``
and ``_apply_on`` to ``mercadolibre.notification``. The core dispatcher
matches ``_topic``. ``_apply_on`` has to be an Odoo model, so the topic
name is not stored there.

Line builders share the usage ``sale.order.line.builder``. The importer
loads them with ``many_components`` and sorts by ``_sequence`` (product
10, shipping 20, fee 30). Add another builder for a coupon or a local
tax without changing the importer.

Odoo 19 rejects a sales order line that has neither a product nor a
display type. An unmatched item is a ``line_note`` with
``mercadolibre_unmatched`` set. The exception rule
``exception_missing_sku`` reads that flag and blocks confirmation.

The status mapper usage is ``status.mapper``. Override ``apply`` for a
different confirmation or cancellation rule. This module leaves paid
orders in draft.

Tracking export is the stock picking listener, not the shipment
importer. The identity keys are:

- ``meli:orders:{backend_id}`` for the batch
- ``meli:order:{backend_id}:{order_id}`` for one order
- ``meli:shipment:{backend_id}:{shipment_id}`` for one shipment
- ``meli:payment:{backend_id}:{resource}`` for a payment notification
- ``meli:tracking:{backend_id}:{shipment_id}`` for a tracking export

Buyers are matched only through ``mercadolibre.res.partner``. The binder
does not search ``res.partner`` by name.

Known issues / Roadmap
======================

- Coupon and discount lines.
- Mercado Pago settlement detail beyond the payment status.
- Invoice fiscal data for each country.
- Pack-level shipping quotes when Mercado Libre splits a cart across
  shipments.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-mercadolibre/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 <https://github.com/OCA/connector-mercadolibre/issues/new?body=module:%20connector_mercadolibre_sale%0Aversion:%2019.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
=======

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-mercadolibre <https://github.com/OCA/connector-mercadolibre/tree/19.0/connector_mercadolibre_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
