Guide: Post-Import Workflows¶
The odoo-data-flow library provides a powerful system for running automated actions on your data after it has been imported into Odoo. This is handled by the odoo-data-flow workflow command.
This feature is designed for complex data migrations where simple importing is not enough. A common use case is in accounting, where imported draft invoices must be validated, reconciled, and paid. Instead of performing these actions manually in the Odoo UI for thousands of records, you can automate them with a workflow.
The invoice-v9 Workflow¶
The library currently includes a built-in workflow specifically for processing customer invoices (account.invoice) in Odoo version 9.
Warning: This workflow uses legacy Odoo v9 API calls and will not work on modern Odoo versions (10.0+). It is provided as a reference and an example of how a post-import process can be structured.
The workflow allows you to perform the following actions on your imported invoices:
tax: Computes taxes for imported draft invoices.validate: Validates draft invoices, moving them to the ‘Open’ state.pay: Registers a payment against an open invoice, moving it to the ‘Paid’ state.proforma: Converts draft invoices to pro-forma invoices.rename: A utility to move a value from a custom field to the officialnumberfield.
Usage¶
You run the workflow from the command line, specifying which action(s) you want to perform.
odoo-data-flow workflow invoice-v9 [OPTIONS]
Command-Line Options¶
Option |
Description |
|---|---|
|
Required. Path to your |
|
The workflow action to run ( |
|
Required. The name of the field in |
|
Required. A dictionary string that maps Odoo states to your legacy statuses. For example: |
|
Required. The name of the field containing the payment date, used by the |
|
Required. The database ID (integer) of the |
|
The number of parallel threads to use for processing. Defaults to |
Example Command¶
Imagine you have imported thousands of invoices. Now, you want to find all the invoices with a legacy status of “Validated” and move them to the “Open” state in Odoo.
You would run the following command:
odoo-data-flow workflow invoice-v9 \
--config conf/connection.conf \
--action validate \
--field x_studio_legacy_status \
--status-map "{'open': ['Validated']}" \
--paid-date-field x_studio_payment_date \
--payment-journal 5
This command will:
Connect to Odoo.
Search for all
account.invoicerecords wherex_studio_legacy_statusis ‘Validated’.Run the
validate_invoicefunction on those records, triggering the workflow to open them.