ml-connector
OdooSFTP / Flat Files

Odoo and SFTP / Flat Files integration

Odoo runs your accounting, procurement, and HR. SFTP / Flat Files connects your Odoo instance to legacy ERP systems, EDI trading partners, and file-based workflows. ml-connector polls Odoo on a schedule tied to your business cycle, exports the records you need in your chosen format, and deposits them on the SFTP server. When trading partners or downstream systems push files back to the same server, ml-connector can ingest them into Odoo without re-keying.

How Odoo works

Odoo exposes accounting, purchasing, inventory, HR, and CRM data through XML-RPC (legacy) and JSON-2 (Odoo 19+) APIs over HTTP POST. Both transports use API key authentication paired with a username login. Odoo Online instances use https://<subdomain>.odoo.com; self-hosted and Odoo.sh instances have their own base URLs. Key entities include invoices, purchase orders, vendors, GL accounts, employees, and analytic cost centers. Odoo does not provide production-grade webhooks, so integration relies on polling with a high-water-mark timestamp on write_date to capture only new and modified records.

How SFTP / Flat Files works

SFTP / Flat Files is a file-transfer protocol layer where data arrives and departs as structured text files on a remote SFTP server. Each trading partner provides their own host and port. Authentication uses SSH keys (recommended) or username and password. Data formats include CSV for simple flat tables, X12 EDI for structured accounting documents (810 invoices, 850 purchase orders, 820 payments), EDIFACT for international EDI, and fixed-width files for legacy systems. SFTP has no push mechanism, so inbound file discovery relies on polling. The standard folder layout includes inbound/, outbound/, processed/, error/, and acks/ directories. EDI acknowledgments (X12 997 or EDIFACT CONTRL) must be produced after receiving inbound files.

What moves between them

Records flow from Odoo to SFTP / Flat Files on a schedule you control. ml-connector reads invoices, purchase orders, vendors, payments, GL accounts, cost centers, and employees from Odoo using the JSON-2 API with high-water-mark polling. It transforms each record into your chosen format - CSV for simple export, X12 EDI for trading partners, or fixed-width for legacy systems - and writes the files to the SFTP outbound folder. Optionally, ml-connector monitors the inbound folder for files from partners or downstream systems, ingests them (respecting your format and column mapping), and loads them into Odoo as new records or updates to existing ones.

How ml-connector handles it

ml-connector stores the Odoo API key encrypted and presents it as a Bearer token on every JSON-2 request, with automatic retry on network errors. On the SFTP side, it uses SSH key-based authentication with your private key stored encrypted, performs host key verification to prevent man-in-the-middle attacks, and creates the required folder structure if it does not exist. For each polling cycle, ml-connector queries Odoo with a filter on write_date using the timestamp of the last successful sync, so only new and modified records are fetched. It maps the records you specify - invoices to X12 810, purchase orders to X12 850, payments to X12 820, GL accounts to CSV - and writes them to the outbound folder with a date-stamped filename. When processing inbound files from partners, ml-connector parses the format (CSV, X12, or fixed-width), validates the column layout against your mapping, and creates or updates the matching Odoo records in the correct module (Accounting, Purchasing, etc.). Every file transfer, parse, and record creation is logged with a full audit trail, and failed records are moved to the error folder for manual review.

A real-world example

A mid-sized manufacturing company runs Odoo for accounting and procurement across three locations. They exchange invoices and purchase orders with a large EDI-connected customer via flat files on a shared SFTP server, and they also integrate with a legacy inventory system that only accepts fixed-width GL posting files. Before the integration, the procurement team manually exported invoices from Odoo, converted them to X12 format offline, and uploaded them to the SFTP server twice a week. At month-end close, the finance team downloaded GL posting files from the legacy system, parsed them by hand, and re-entered each transaction into Odoo's journal. With Odoo and SFTP / Flat Files connected, invoices flow automatically to the customer on schedule, GL postings from the legacy system are ingested directly into Odoo's general ledger, and the manual file conversions and re-keying are eliminated.

What you can do

  • Export Odoo invoices, purchase orders, and payments to the SFTP server in CSV, X12 EDI, or fixed-width format on a schedule you control.
  • Ingest incoming files from trading partners or legacy systems and load them into Odoo as new accounting records or updates to existing vendors and GL accounts.
  • Authenticate Odoo with API key bearer token and SFTP with SSH key-based authentication, with full encryption of stored credentials.
  • Map record fields between Odoo modules (Accounting, Purchasing, HR) and your chosen file format using a simple column-layout specification per trading partner.
  • Produce EDI acknowledgments (X12 997 or EDIFACT CONTRL) after processing inbound files, and maintain a complete audit log of every file transfer and record creation.

Questions

Which direction does data move between Odoo and SFTP / Flat Files?
Data primarily flows from Odoo to SFTP / Flat Files - invoices, purchase orders, payments, and GL accounts are exported on schedule in your chosen format and written to the outbound folder. ml-connector can also monitor the inbound folder for files from trading partners or legacy systems and load them back into Odoo. The direction and frequency depend on your business process and trading-partner requirements.
How does ml-connector handle the different file formats like CSV, X12, and fixed-width?
Each trading partner or system connection specifies a format and column layout. ml-connector uses that mapping to transform Odoo records into the target format (CSV uses headers and rows; X12 uses segment codes and field positions; fixed-width uses column positions). When processing inbound files, ml-connector reverses the mapping, parsing the file according to the layout spec and loading the records into Odoo.
How does polling work if Odoo and the SFTP server have no push notifications?
ml-connector queries Odoo on a schedule you set (e.g. every 15 minutes, daily, or weekly) using a filter on write_date to capture only records modified since the last sync. It separately polls the SFTP inbound folder on the same or a different schedule, checking for new files. Timestamps ensure no records are duplicated, and the audit log tracks every sync cycle and any errors.

Related integrations

Connect Odoo and SFTP / Flat Files

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started