Share Odoo Stock & Prices with Qogita

Selling on the Qogita B2B marketplace? Odoo shares your products, GTINs, available stock and wholesale prices with Qogita automatically, so buyers always see what you can actually ship.

Qogita Integration for Odoo

Summary

Selling on Qogita? Our Odoo integration gives Qogita a secure, always-current feed of your GTINs, SKUs, available stock and wholesale prices. It provides a secure API configuration interface within Odoo to generate 256-bit cryptographic access keys and exposes an authenticated REST API endpoint (/qogita/stocks). Through this endpoint, Qogita can pull real-time inventory counts and distributor shop pricing for storable products available for sale, eliminating manual spreadsheet updates and stockouts across European wholesale distribution channels.

For the client, we have implemented the automated Qogita stock sharing workflow in Odoo 17. Qogita operates as an external wholesale marketplace requiring continuous stock visibility without granting direct database access. The integration provides a lightweight, performant REST controller that processes incoming GET and POST requests, validates caller authenticity via custom HTTP headers, applies strict product filtering rules, calculates distributor-specific pricing dynamically via Odoo's pricelist engine, and returns a structured JSON payload.

Authentication & API Configuration

To manage API credentials securely, an API Configuration interface is implemented in Odoo under Inventory > Configuration > API > API Configuration (accessible in Developer Mode). A dedicated transient wizard (qogita.config) manages the API key lifecycle. When an administrator clicks “Generate New API Key”, the system uses Python's secrets module to generate a cryptographically strong 32-byte hex key (secrets.token_hex(32)) and stores it persistently in Odoo System Parameters (ir.config_parameter under the key qogita.api_key). The UI immediately refreshes to display the active key, which can be copied and provided to Qogita for authentication.

Figure 1: Qogita API Configuration form in Odoo 17 showing the generated API Key.

Authentication Mechanism

Calls to the integration endpoint (/qogita/stocks) are authenticated using a custom HTTP request header: X-API-KEY. The endpoint operates with public authorization (auth='public') and disabled CSRF validation (csrf=False) to support machine-to-machine REST communication. When a request arrives, Odoo extracts the X-API-KEY header and matches it against the stored system key in ir.config_parameter. If the header is missing, empty, or does not match the configured system key, Odoo immediately rejects the request with an HTTP 401 Unauthorized exception ('Invalid API Key'), ensuring that unauthorized third parties cannot access company inventory or pricing.

Stock Synchronization Endpoint & Business Rules

The endpoint /qogita/stocks retrieves stock data according to specific business rules configured in Odoo:

  • Product Filtering: The query filters the product catalog (product.product) using the domain [("sale_ok", "=", True), ("type", "=", "product")]. This ensures that only active, sellable, storable physical goods are included, filtering out services, consumables, and archived products.
  • Dynamic Distributor Pricing: Prices are calculated dynamically. Odoo searches for the designated pricelist named "Sales_Distributor_Shop" and evaluates the current selling price for each product using pricelist._get_product_price(product, 1, False). This ensures that Qogita receives wholesale distributor pricing reflective of current currency rules, margins, and discounts configured in Odoo.
  • Real-Time Available Stock: Odoo extracts product.qty_available (physical on-hand inventory) for each matching item to guarantee accurate stock allocation without risk of overselling.

Exported Data Schema

Each product in the response array is mapped to a standardized data dictionary required by the Qogita platform:

  • GTIN: Global Trade Item Number / EAN / Barcode (product.barcode).
  • SKU: Stock Keeping Unit / Internal Reference (product.default_code).
  • Available Inventory: Real-time physical quantity available on hand (product.qty_available).
  • Product Name: Complete display name of the product (product.name).
  • Price: Wholesale distributor selling price evaluated against the Sales_Distributor_Shop pricelist.

API Verification and Testing

The endpoint can be queried via cURL, Postman, or automated synchronization cron jobs from Qogita using GET or POST methods.

Sample cURL Request:

curl -X GET "https://<odoo_instance_url>/qogita/stocks" \
     -H "X-API-KEY: 3a9f7e8c1b4d2a6e9f0c8b7a6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e"

Sample 200 OK Response Payload (JSON):

{
  "success": true,
  "message": "Stock data retrieved successfully",
  "data": [
    {
      "GTIN": "5012345678900",
      "SKU": "PERF-CHAN-001",
      "Available Inventory": 120.0,
      "Product Name": "Bleu de Chanel Eau de Parfum 100ml",
      "Price": 115.50
    },
    {
      "GTIN": "3349666007891",
      "SKU": "PERF-DIOR-002",
      "Available Inventory": 45.0,
      "Product Name": "Sauvage Eau de Toilette 100ml",
      "Price": 98.00
    }
  ]
}

Conclusion

The Qogita integration in Odoo 17 establishes a secure, automated data pipeline between Odoo and the Qogita B2B wholesale platform. By exposing an authenticated REST endpoint with dynamic distributor pricing calculations and real-time inventory counts, the integration ensures accurate stock availability without manual spreadsheet exports or human error. Administrators can rotate API keys securely on demand, while external wholesale buyers receive up-to-date catalog inventory directly from Odoo.

Need a Similar Odoo Integration

WhatsApp