Trackline Integration with Odoo
Export documents and additional data from Trackline to Odoo via API queries
Learn step by step how to integrate Trackline with Odoo
Trackline is a functionality of the Code Contract platform that automates information collection without altering workflows or requiring manual entries.
If you want to integrate Trackline with Odoo to retrieve documents and process data, follow these steps using JWT Token authentication.
Step 1: Get the authentication token
Odoo must authenticate with the Trackline API via a POST request to obtain a JWT token. This token will be used in subsequent requests.
Request from Odoo (HTTP Request)
http
POST /login HTTP/1.1
Host: api.codecontractplattform.com
Content-Type: application/json
{
"email": "odoo_integration_user",
"password": "odoo_secure_password"
}
Expected Response
http
HTTP/1.1 200 OK
Content-Type: application/json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV..."
}
The token value must be stored in Odoo and sent in each request as a Bearer Token in the Authorization header.
Step 2: Query additional data and files in Trackline from Odoo
Query additional data of a process
Odoo can retrieve information about a specific process using either process_id or process_name.
Request from Odoo
http
GET /track-line/ext/track-path/metadata?process_id=12345 HTTP/1.1
Host: api.codecontractplattform.com
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV...
Expected Response
{
"process_id": "12345",
"name": "Odoo Billing Process",
"status": "In Progress",
"created_at": "2024-02-09T10:30:00Z",
"documents": [
{
"doc_id": "98765",
"doc_name": "Invoice_001.pdf",
"doc_type": "Invoice"
}
]
}
Odoo can use this information to automatically manage processes and documents.
Download an attachment
Once metadata is retrieved, Odoo can download an attachment by its attachment_id.
Request from Odoo
http
GET /track-line/ext/attachment/file?attachment_id=98765 HTTP/1.1
Host: api.codecontractplattform.com
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV...
Expected response (File)
The server will respond with a PDF, XML or the appropriate format, which Odoo can store or process.
Odoo Integration (Python Example)
If you need to integrate this functionality into Odoo using Python and Odoo API, you can use the following code in a custom module:
(🔁 Misma sección de código Python que en español – no se traduce para mantener compatibilidad)
This code allows Odoo to:
- Obtain the authentication token
- Query metadata of a specific process in Trackline
- Download an attachment associated with the process
The code can be executed from an action button in an Odoo model to integrate it into the user interface.
Summary
✔️ Step 1: Odoo gets JWT Token via authentication
✔️ Step 2: Odoo queries process metadata with process_id
✔️ Step 3: Odoo downloads attachments via attachment_id
✔️ Step 4: Odoo can automate these processes using Python and the Odoo API
For more information or support, contact the Code Contract team. 🚀
