# Odoo

> How Odoo 19 hands lots and serial numbers to BatteryPass through the JSON-2 API.

> [!NOTE]
> This page describes an integration pattern. BatteryPass ships no connector for Odoo and has no partnership with Odoo
> S.A.; nothing here is a vendor approval.

Odoo 19 offers the JSON-2 API: `POST /json/2/<model>/<method>` with an API key as bearer token. Serial numbers are
records of `stock.lot`, manufacturing orders of `mrp.production`. The `odoo-stock-lot` preset maps the lot or serial
number and the product's internal reference; Odoo keeps no manufacturing date on the lot, so the middleware adds the
column "Manufacturing Date", for example from the end date of the manufacturing order.

API keys carry an expiry date: put their rotation in your operations plan, as you do for the BatteryPass key. XML-RPC
and JSON-RPC are deprecated and go away with Odoo 22 (fall 2028) and Odoo Online 21.1; do not build new integrations
on them.

Automation rules can send a record to a URL as an outgoing webhook. The payload is not signed, so treat it as a hint:
the middleware reads the record through the JSON-2 API before it acts. From there, follow
[units from production](https://passport.kabin.sh/docs/en/integrations/workflows/units-from-production).

## Interfaces and how they were checked

- **Vendor:** Odoo S.A.
- **Cloud:** Odoo Online and Odoo.sh 19
- **On-premise:** Odoo 19 Community and Enterprise

Odoo 19 offers the JSON-2 API with API keys as bearer tokens; XML-RPC and JSON-RPC are deprecated and go away with Odoo 22 (fall 2028) and Odoo Online 21.1. API keys have an expiry date: rotation belongs in the operations plan.

An integration pattern, not a connector: BatteryPass ships no ERP connector and holds no vendor certification.

| Interface                                                                                                                                                                                      | Protocol | Sign-in          | Events                | Objects                                                                                      | Checked                                         |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------- | --------------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| [`JSON-2 API (/json/2/<model>/<method>)`](https://www.odoo.com/documentation/19.0/developer/reference/external_api.html) (Every model, for example product.product, stock.lot, mrp.production) | REST     | API key          | none                  | Product/material master, Batch/serial number, Production order, Delivery/goods issue, Return | checked in the vendor documentation, 24/10/2026 |
| [`Webhooks (automation rules)`](https://www.odoo.com/documentation/19.0/applications/studio/automated_actions/webhooks.html) (Outgoing webhooks from automation rules)                         | REST     | API key          | Webhooks (not signed) | Product/material master, Batch/serial number, Production order                               | checked in the vendor documentation, 24/10/2026 |
| [`XML-RPC and JSON-RPC (deprecated)`](https://www.odoo.com/documentation/19.0/developer/reference/external_api.html) (Older external API)                                                      | XML-RPC  | API key, Session | none                  | Product/material master, Batch/serial number, Production order, Delivery/goods issue, Return | checked in the vendor documentation, 24/10/2026 |

**Notes**

- `Webhooks (automation rules)`: The payload is not signed; for incoming webhooks the secret URL is the protection.
- `XML-RPC and JSON-RPC (deprecated)`: Do not use for new integrations.

**Import presets: Odoo lots and serial numbers (stock.lot)** (`odoo-stock-lot`): An export of the stock.lot model from Odoo with the product's internal reference. Odoo keeps no manufacturing date on the lot; the middleware adds the column "Manufacturing Date", for example from the end date of the manufacturing order.

| Column in the export                                                                  | Field in BatteryPass                                     |
| ------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| `Lot/Serial Number` (also name, Los-/Seriennummer)                                    | Serial number `identification.serial_number`             |
| `Product/Internal Reference` (also product_id/default_code, Produkt/Interne Referenz) | Model identifier / SKU `identification.model_identifier` |
| `Manufacturing Date` (also date_finished, Herstelldatum)                              | Manufacturing date `identification.manufacturing_date`   |

**Import presets: Generic CSV file** (`generic-csv`): For any ERP and for files a middleware writes itself: GTIN, serial number, manufacturing date, facility (name or GLN), model version and battery status, with German and English column names.

| Column in the export                                          | Field in BatteryPass                                      |
| ------------------------------------------------------------- | --------------------------------------------------------- |
| `GTIN` (also EAN, GTIN-13, GTIN-14)                           | GTIN (GS1) `identification.gtin`                          |
| `Serial number` (also Seriennummer, serial_number)            | Serial number `identification.serial_number`              |
| `Manufacturing date` (also Herstelldatum, manufacturing_date) | Manufacturing date `identification.manufacturing_date`    |
| `Facility` (also Produktionsstätte, Facility GLN, Werk-GLN)   | Place of manufacture `identification.manufacturing_place` |
| `Model version` (also Modellversion, model_version)           | Model version `model_version`                             |
| `Battery status` (also Batteriestatus, battery_status)        | Battery status `identification.battery_status`            |

## Workflows

- [Units from production](https://passport.kabin.sh/docs/en/integrations/workflows/units-from-production.md): Serial numbers from the production confirmation or goods receipt are staged as an import; members review, commit and approve before any passport appears. Key scopes: import
- [Passport links back into the ERP](https://passport.kabin.sh/docs/en/integrations/workflows/passport-links-to-erp.md): The middleware follows the change feed and writes the GS1 Digital Link and the passport status to the serial number record in the ERP, so labels and delivery papers carry it. Key scopes: read
- [Returns and repairs as lifecycle events](https://passport.kabin.sh/docs/en/integrations/workflows/returns-and-repairs.md): Completed repairs, inspections and component replacements from service or return orders appear as events in the unit's history. Key scopes: read, condition
- [Product change leads to a new model version](https://passport.kabin.sh/docs/en/integrations/workflows/product-change.md): A change to the product master in the ERP triggers a notification; a member creates a new model version in BatteryPass. Declared data is never written automatically. Key scopes: read
