| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Helpdesk (helpdesk)
• Sales (sale_management) • Discuss (mail) • Invoicing (account) • Inventory (stock) |
| Community Apps Dependencies | Show |
| Lines of code | 19678 |
| Technical Name |
shop_apotheke |
| License | OPL-1 |
| Website | https://www.cognisance.de |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Helpdesk (helpdesk)
• Sales (sale_management) • Discuss (mail) • Invoicing (account) • Inventory (stock) |
| Community Apps Dependencies | Show |
| Lines of code | 19678 |
| Technical Name |
shop_apotheke |
| License | OPL-1 |
| Website | https://www.cognisance.de |
Mirakl Marketplace Connector
A full Mirakl operating layer for Odoo covering catalog synchronization, order import, shipment feedback, invoice upload, refund synchronization, Mirakl helpdesk communication, OR21 order acceptance, incident management, PA01 customer-debit confirmation, payout reconciliation, live webhooks, and stock-drift detection.
20+Mirakl API Endpoints
9New Operational Features
1Unified Odoo Workflow
Highlights
- Imports orders, listings, credit notes, master data, product attributes, and value lists from Mirakl.
- Exports stock and shipment tracking updates from Odoo back to the marketplace.
- Synchronizes categories, channels, carriers, shipping zones, logistic classes, reasons, and catalog metadata.
- Uploads invoice PDFs and sends Odoo credit-note refunds to Mirakl.
- Turns Mirakl order threads into actionable Odoo Helpdesk tickets with reply support.
- Accepts or refuses pending Mirakl orders (OR21) directly from the sales order header.
- Opens and closes Mirakl incidents from Odoo to protect the seller during open claims.
- Confirms Mirakl-managed customer payments (PA01) and pulls payout reports for accounting.
- Receives live Mirakl webhooks with HMAC-SHA256 signature verification.
- Detects stock and offer drift between Odoo and Mirakl through a periodic reverse-sync.
- Translates Mirakl per-line promotions and order discounts into Odoo discount percentages.
- Includes queues, retries, logs, dashboards, watchdog automation, and a unit-test suite.
Feature Overview
Order and Sales Flow
- Order import by create date, update date, or specific marketplace order.
- Customer, invoice, and shipping partner creation from Mirakl payloads.
- Marketplace status, provision, channel, and delivery metadata on the Odoo sales order.
- Credit-note import and duplicate shipping-line cleanup helpers.
Catalog and Listings
- Listing and offer import with SKU filters, stock-only mode, and only-new-product mode.
- Optional update of existing Odoo products and prices during listing import.
- Attribute, category, and value-list synchronization for Mirakl catalog compliance.
- Product merge workflows and mapping support for imported marketplace items.
Shipping and Invoicing
- Inventory export from Odoo to Mirakl.
- Tracking export with central Mirakl carrier configuration and tracking URLs.
- Shipping watchdog automation for completed pickings that still need confirmation.
- Optional invoice PDF upload when shipments are sent to Mirakl.
Refunds and Support
- Refund payload generation from Odoo credit notes and transmission to Mirakl.
- Remote refund IDs, timestamps, states, and error handling stored in Odoo.
- Mirakl inbox synchronization into Odoo Helpdesk with attachments and replies.
- Ticket-side order cancellation and delivery visibility for support teams.
Order Acceptance (OR21)
Mirakl: AnnehmenandMirakl: Ablehnenbuttons on the sales order header.- Visible automatically while the Mirakl order is in
WAITING_ACCEPTANCE. - Sends per-line decisions to
PUT /api/orders/{order_id}/accept. - Local
mirakl_acceptance_statemirror with timestamp.
Incident Management
Incident öffnenandIncident schließenbuttons on shipped Mirakl orders.- Calls
POSTandDELETE /api/orders/{order_id}/incident. - Protects the seller from auto-refund timeouts while a claim is open.
- Stores open/closed state and timestamps on the sales order.
Customer Debit (PA01) and Payouts
Mirakl-Payment-Modustoggle on the marketplace instance.PA01: Customer Debitbutton on customer invoices linked to a Mirakl sales order.- Optional cron
Mirakl: Customer Debit Confirmation (PA01)for paid invoices. Payouts ziehenpulls Mirakl payment history and self-billing PDFs asir.attachment.
Live Webhooks
- Per-instance endpoint
/mirakl/webhook/<int:instance_id>. - HMAC-SHA256 signature verification with per-instance secret.
- Dispatches
ORDER_CREATED,ORDER_STATE_CHANGED,ORDER_REFUSED,MESSAGE_RECEIVED,REFUND_CREATED. - Auto-computed webhook URL on the instance form for one-click copy.
Drift & Offer-Diff
- Configurable stock-drift threshold and on-demand
Drift jetzt prüfenbutton. - Reverse-reads
GET /api/offersin pages of 100 entries. - Reports stock drift, orphan offers (Mirakl-only), and missing offers (Odoo-only).
- Optional cron
Mirakl: Stock & Offer Drift Checkevery six hours.
Discount Handling & Tests
- Translates per-line
promotionsarrays into Odoo discount percentages. - Falls back to top-level
order_discountaggregate spread across non-shipping lines. - Ships a
tests/package with a Mirakl-aware mock for_send_mirakl_request. - Tagged tests for selective runs:
mirakl_request,mirakl_webhook,mirakl_offer_diff,mirakl_stock_drift,mirakl_order_accept,mirakl_sale_order.
API Endpoints Used
The connector talks to the following Mirakl seller-API endpoints. Endpoints marked (new) were added in version 19.0.1.0.3.
Master Data & Catalog
GET /api/accountGET /api/channels,/api/hierarchies,/api/reasonsGET /api/shipping/carriers,/api/shipping/zones,/api/shipping/logistic_classesGET /api/offers/states,/api/products/attributesPOST/GET /api/products/imports,/api/offers,/api/offers/imports,/api/offers/stock/imports
Orders & Fulfillment
GET /api/orders,/api/orders/documentsPUT /api/orders/{id}/cancel,/api/orders/{id}/trackingPOST /api/orders/refundPUT /api/orders/{id}/accept(new)POST/DELETE /api/orders/{id}/incident(new)
Payments & Self-Billing
GET /api/sellerpayment/transactions_logsPOST /api/payment/debit(new)GET /api/payment/payments_history(new)GET /api/payment/payment_documents/{id}/download(new)
Helpdesk Inbox
GET /api/inbox/threadsGET /api/inbox/threads/{id}POST /api/inbox/threads/{id}/messageGET /api/inbox/threads/{id}/download
Requirements
Odoo Stack
base_marketplacehelpdesk- Configured sales, stock, invoicing, and delivery workflows
Marketplace Setup
- Mirakl API endpoint and API key
- Shop and carrier configuration
- Category and attribute mappings
- Optional
cognisance_brandmappluscognisance_brandmap_miraklfor Mirakl brand mappings - Working invoice PDF reporting for upload workflows
Screenshots
Documentation screenshots from the Mirakl marketplace connector in Odoo.
Instance Configuration
Import Operations
Dashboard
Orders
Queue
Configuration and Mapping
Listings
Credit Notes
Helpdesk
Typical Flow
- Configure the marketplace instance and import master data, attributes, and value lists.
- Import listings and marketplace orders into Odoo.
- Accept or refuse new Mirakl orders from the sales order header (OR21) when the marketplace requires explicit acceptance.
- Fulfill orders in Odoo and export stock plus shipment tracking back to Mirakl.
- Open Mirakl incidents from Odoo if a customer claim cannot be resolved through standard refund or shipment correction.
- Upload invoices and synchronize refunds. For Mirakl-payment instances, confirm the customer debit (PA01) from the invoice or via cron.
- Pull payout history and self-billing PDFs into Odoo for accounting reconciliation.
- Run the drift detector regularly to catch stock and offer divergences between Odoo and Mirakl before they affect customers.
Inbound Webhooks
Endpoint
- URL:
<your-odoo-base-url>/mirakl/webhook/<int:instance_id> - Method:
POST - Content type:
application/json - Public route, no Odoo session required.
Signature
- Header:
X-Mirakl-SignatureorX-Hub-Signature-256. - Scheme: HMAC-SHA256 of the raw request body using the per-instance secret.
- Accepted formats:
<hex>orsha256=<hex>. - Failures return
401; transient processing errors return202to avoid retry storms.
Field Reference
The new feature blocks add the following fields. All fields are scoped to Mirakl marketplace instances and have no effect on other marketplaces.
mk.instance
mirakl_webhook_enabled(Boolean) - master switch for the inbound webhook endpoint.mirakl_webhook_secret(Char, password) - HMAC-SHA256 secret shared with Mirakl.mirakl_webhook_url_display(Char, computed) - public webhook URL for one-click copy.mirakl_drift_threshold(Integer, default 1) - drift below this delta is ignored.mirakl_drift_last_run/mirakl_drift_last_summary- last sweep timestamp and result.mirakl_payment_self_managed(Boolean) - PA01 mode toggle.mirakl_last_payout_pull(Datetime, readonly) - last successful payout-history fetch.
sale.order
mirakl_acceptance_state(Selection) -pending/accepted/refused.mirakl_acceptance_sent_at- when OR21 was transmitted.mirakl_acceptance_can_decide(computed) - drives the OR21 button visibility.mirakl_incident_open/mirakl_incident_opened_at- incident state and timestamp.mirakl_can_open_incident(computed) - true when order is shipped and no incident is open.
account.move
mirakl_customer_debit_sent(Boolean, readonly) - true after successful PA01 call.mirakl_customer_debit_sent_at- PA01 timestamp.
Behavior Details
Webhook Event Routing
ORDER_CREATED/ORDER_STATE_CHANGED/ORDER_REFUSEDre-import the order viasale.order.mirakl_import_single_order.MESSAGE_RECEIVEDcalls the helpdesk thread sync.REFUND_CREATEDaliases to the order handler.- Response codes:
200ok,401bad signature,403webhook off,404instance unknown,400bad JSON,202on internal error (no retry storm).
Drift Detector Internals
- Pages
GET /api/offerswithmax=100; loop ends when a page returns less than 100. - Multi-pack offers translate
free_qtythroughmirakl_offer_product_qtybefore comparison. - Pure helper
_mirakl_filter_stock_driftis exposed for unit-testing without network calls. - Cron catches exceptions per instance; one misconfigured shop cannot break the sweep.
Refuse Reason Fallback
- Resolves in order:
mirakl_default_refuse_reason_code,mirakl_default_cancel_reason_code,mirakl_default_refund_reason_code. - If none is set, the refuse button raises
UserError. - Per-line decisions with mixed accept/refuse - call
_mirakl_send_order_acceptancedirectly.
Incident Payload
- Open:
POST /api/orders/<id>/incidentwith{"order_lines":[{"order_line_id":"...","reason_code":"INCIDENT_OPEN"}]}. - Close:
DELETE /api/orders/<id>/incident?order_line_ids=L1,L2,.... - While open, Mirakl pauses auto-refund timeouts on the order.
PA01 Cron Criteria
move_type = out_invoiceANDstate = postedANDmirakl_sale_order_idset.mirakl_customer_debit_sentis False.payment_statein (paid,in_payment,partial).- Linked instance has
mirakl_payment_self_managed = True.
Payout PDF Storage
- Incremental: each pull uses
start_date = mirakl_last_payout_pull. - Download via
response_mode='raw'to bypass JSON parsing. - Stored as
ir.attachmentwithres_model = "mk.instance", namemirakl_payment_<id>.pdf. - Surfaces in the chatter of the marketplace instance.
Discount Maths
- Per-line:
(sum(promotions[].amount) / base_total) * 100, clamped to[0, 100]. - Only
discountis touched;price_unitstays at the Mirakl original. - Global fallback only when no per-line promotions exist; spread over non-shipping lines.
- Writes use
_marketplace_silent_sync_context()to avoid echoing changes back to Mirakl.
Test Mock Patterns
- Route table:
mock_mirakl({(method, path_substring): response}). - Single response:
mock_mirakl_response(env, payload). - Base class
MiraklTestCaseprovidesself.instancewith realistic credentials. - Tags allow selective runs:
--test-tags mirakl_requestetc.
Limitations
- Per-line accept/refuse mix - the UI buttons currently accept-all or refuse-all. For mixed decisions, call
_mirakl_send_order_acceptancedirectly. A line-level wizard is on the backlog. - Webhook retry policy - inbound webhooks are processed inline. No durable queue layer; transient Odoo errors are answered with
202so Mirakl does not retry. - Drift auto-correction - the detector reports differences but does not mutate Mirakl or Odoo state. Re-pushing stock is a separate operation.
- Discount type fidelity -
PERCENT_DISCOUNTversusFLAT_DISCOUNTis collapsed into a single percentage; the originalpromotions[].typeis not retained on the line. - Payout reconciliation - downloaded self-billing PDFs are stored as attachments. Automatic matching against bank statements remains a manual accounting step.
Automation (Cron)
Mirakl Order Import: imports new or changed marketplace orders.Mirakl Stock Export: pushes updated Odoo inventory to Mirakl.Mirakl Tracking Export: confirms completed shipments back to Mirakl.Mirakl Shipping Watchdog: retries completed shipments that still need marketplace confirmation.Mirakl Helpdesk Thread Sync: imports Mirakl inbox threads into Odoo Helpdesk when enabled.Mirakl: Stock & Offer Drift Check(default off): runs the drift and offer-diff diagnostics every six hours.Mirakl: Customer Debit Confirmation (PA01)(default off): scans paid invoices on Mirakl-payment instances every fifteen minutes and sendsPOST /api/payment/debit.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module