Odoo integration code components

Odoo integration code components

Part of the Odoo – OpenELIS guide: the OpenELIS classes that implement the integration, for developers. Setup, behaviour and troubleshooting are in the main guide. Checked against the OpenELIS develop source code (November 2026).

Components

Class

Role

Class

Role

OdooClient

XML-RPC client. init() checks that the four connection properties are set and authenticates once on /xmlrpc/2/common. Every other call goes to /xmlrpc/2/object with execute_kw: create, write, delete, search and searchAndRead.

OdooConnection

The interface the rest of OpenELIS uses: isAvailable(), create() and searchAndRead(). RealOdooClient delegates to OdooClient. NoOpOdooClient reports unavailable, logs a warning and returns nothing.

OdooConnectionConfig

Chooses the OdooConnection bean at startup from org.openelisglobal.odoo.enabled. With true it calls OdooClient.init(); if that fails, it logs the error and uses NoOpOdooClient until the next restart.

SamplePatientUpdateDataCreatedEventListener

Receives the SamplePatientUpdateDataCreatedEvent that SamplePatientEntryServiceImpl.persistData() publishes when an order is saved. It runs asynchronously and only after the order transaction commits, so a rolled-back save creates no invoice. Errors are logged and never reach the user.

OdooIntegrationService

createInvoice(): skips when Odoo is unavailable, finds or creates the customer (res.partner), builds one line per mapped test and creates the account.move.

TestProductMapping

Loads the mapping CSV once at startup from /var/lib/openelis-global/odoo/odoo-test-product-mapping.csv and answers lookups by test name.

HealthCheckController

GET /health/odoo: returns the result of isAvailable(), which reflects the startup connection.

OdooXmlRpcTypeFactory

Parses Odoo responses as plain data and refuses serialized Java fault causes. Not in OpenELIS 3.3.0.

Data flow

Order saved (transaction commits) -> SamplePatientUpdateDataCreatedEvent -> SamplePatientUpdateDataCreatedEventListener (async) -> OdooIntegrationService.createInvoice() -> find or create the customer (res.partner) -> map each test through TestProductMapping into invoice lines -> create the draft invoice (account.move, out_invoice) -> OdooConnection (RealOdooClient -> OdooClient, XML-RPC)