[Skip to content](#main)

[→](/)

[![Avunu](/brand/avunu-logo.svg)![Avunu](/brand/avunu-logo-light.svg)](/)[Services](/services/)[Consulting](/services/consulting/)[ERP](/services/erp/)[Odoo](/services/erp/odoo/)[ERPNext](/services/erp/erpnext/)[Custom software](/services/custom-software/)[Devices & IoT](/services/devices-iot/)[Websites](/services/websites/)[Infrastructure](/services/infrastructure/)[Partners](/partners/)

[Work](/work/)[Open source](/open-source/)[Knowledge base](/kb/)[About](/about/)

[About Avunu](/about/)[Team](/about/team/)[Insights](/insights/)[Contact](/contact/)

[Client portal](https://erp.avunu.net/projects)[Start a project](/start/)

- [Services](/services/)[Consulting](/services/consulting/)
- [ERP](/services/erp/)
- [Odoo](/services/erp/odoo/)
- [ERPNext](/services/erp/erpnext/)
- [Custom software](/services/custom-software/)
- [Devices & IoT](/services/devices-iot/)
- [Websites](/services/websites/)
- [Infrastructure](/services/infrastructure/)
- [Partners](/partners/)

[Work](/work/)[Open source](/open-source/)[Knowledge base](/kb/)[About](/about/)

- [About Avunu](/about/)
- [Team](/about/team/)
- [Insights](/insights/)
- [Contact](/contact/)

[Client portal](https://erp.avunu.net/projects)[Start a project](/start/)

[Knowledge base](/kb/)[Odoo](/kb/odoo/)Importing documents from email into Odoo

Search the knowledge basePress/

ESC

Jump to

[Browse the knowledge base](/kb/)[Frappe](/kb/frappe/)[ERPNext](/kb/erpnext/)[Odoo](/kb/odoo/)[WordPress](/kb/wordpress/)[NixOS](/kb/nixos/)[Email](/kb/email/)[Linux](/kb/linux/)[Databases](/kb/databases/)[Containers](/kb/containers/)[Proxmox](/kb/proxmox/)[Git & Dev Tools](/kb/git-and-dev-tools/)

↵select↑↓navigateescclose

Search the knowledge base

[Skip to the article](#kb-article)[Odoo](/kb/odoo/)7 articles

- [Overview](/kb/odoo/)
- [A repair shop workflow on Odoo 18, from inspection to invoice](/kb/odoo/repair-shop-workflow-on-odoo/)
- [Importing documents from email into Odoo](/kb/odoo/importing-documents-from-email-into-odoo/)
- [Migrating from QuickBooks to Odoo with a clean cutover](/kb/odoo/migrating-from-quickbooks-to-odoo/)
- [Odoo Community and OCA overview](/kb/odoo/odoo-community-and-oca-overview/)
- [Set up and work in an Odoo 18 development environment with odoo-nix](/kb/odoo/odoo-development-environment/)
- [Set up two-way SMS in Odoo with Twilio](/kb/odoo/two-way-sms-in-odoo-with-twilio/)
- [Test custom Odoo modules from the command line](/kb/odoo/testing-custom-odoo-modules/)

Other sections[Frappe](/kb/frappe/)[ERPNext](/kb/erpnext/)[WordPress](/kb/wordpress/)[NixOS](/kb/nixos/)[Email](/kb/email/)[Linux](/kb/linux/)[Databases](/kb/databases/)[Containers](/kb/containers/)[Proxmox](/kb/proxmox/)[Git & Dev Tools](/kb/git-and-dev-tools/)

In Odoo: 7 articles

[Overview](/kb/odoo/)[A repair shop workflow on Odoo 18, from inspection to invoice](/kb/odoo/repair-shop-workflow-on-odoo/)[Importing documents from email into Odoo](/kb/odoo/importing-documents-from-email-into-odoo/)[Migrating from QuickBooks to Odoo with a clean cutover](/kb/odoo/migrating-from-quickbooks-to-odoo/)[Odoo Community and OCA overview](/kb/odoo/odoo-community-and-oca-overview/)[Set up and work in an Odoo 18 development environment with odoo-nix](/kb/odoo/odoo-development-environment/)[Set up two-way SMS in Odoo with Twilio](/kb/odoo/two-way-sms-in-odoo-with-twilio/)[Test custom Odoo modules from the command line](/kb/odoo/testing-custom-odoo-modules/)

Other sections[Frappe](/kb/frappe/)[ERPNext](/kb/erpnext/)[WordPress](/kb/wordpress/)[NixOS](/kb/nixos/)[Email](/kb/email/)[Linux](/kb/linux/)[Databases](/kb/databases/)[Containers](/kb/containers/)[Proxmox](/kb/proxmox/)[Git & Dev Tools](/kb/git-and-dev-tools/)

OdooImporting documents from email into Odoo

Turn vendor emails and printed PDFs into Odoo records with a template-driven pipeline built from Avunu's open-source import addons.

UpdatedNov 7, 2026

Applies toOdoo 18.0edi_import_router 18.0.1.0.0import_from_email 18.0.1.0.0import_via_xberg 18.0.1.0.0import_create_missing 18.0.1.3.0

Tagsodooediemailimport

Reading time17 min

On this page[How the pieces fit](#how-the-pieces-fit)[Install the modules](#install-the-modules)[Set up a template](#set-up-a-template)[Use xberg for tables](#use-xberg-for-tables)[Narrow with JSONPath, then refine with regex](#narrow-with-jsonpath-then-refine-with-regex)[Read a table by header](#read-a-table-by-header)[Tune the extraction](#tune-the-extraction)[Preview while you write](#preview-while-you-write)[Route email into Odoo](#route-email-into-odoo)[Option 1: a direct alias](#option-1-a-direct-alias)[Option 2: the import router](#option-2-the-import-router)[Forwarding from Gmail](#forwarding-from-gmail)[Printed documents](#printed-documents)[Create missing records](#create-missing-records)[Troubleshooting](#troubleshooting)[What this document does not cover](#what-this-document-does-not-cover)[Related documents](#related-documents)

This document explains how Avunu's import addons fit together, so that a vendor quote, order confirmation or invoice that arrives by email, or that someone prints to PDF, becomes an Odoo record without retyping. Read it when you want to set up that pipeline, or when you need to add one more document type to it.

All of the modules live in the public [edi-addons](https://github.com/Avunu/edi-addons) repository, on the `18.0` branch, which extends [OCA/edi](https://github.com/OCA/edi). They are licensed AGPL-3. Their documentation is also published at [docs.avunu.net/edi-addons](https://docs.avunu.net/edi-addons/).

## How the pieces fit

Everything is built on the `base_import_pdf_by_template` module, which turns a document into text and pulls fields out of that text with per-line regular expressions. A template (`base.import.pdf.template`) targets one Odoo model, and each template line says which field to fill and which regex finds the value. Avunu's modules add sources, tooling and routing around that core.

| Module                               | What it adds                                                                                                                           |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `base_import_pdf_by_template_engine` | Two small extension points that the other modules plug into, plus fixes for two table-extraction bugs.                                 |
| `import_from_email`                  | `plaintext` and `html` extraction modes, a mail alias that creates EDI exchange records, and a generic processor that runs a template. |
| `import_via_xberg`                   | An `xberg` extraction mode that parses a document into structured JSON, with a JSONPath step that narrows what a regex searches.       |
| `import_preview`                     | A saved sample document per template and a live preview of what each line matches.                                                     |
| `import_create_missing`              | Creates a missing linked record (a vendor, a product) during import instead of leaving the field unresolved.                           |
| `import_create_missing_xberg`        | Per-row JSONPath for the previous module. It installs itself when both of its dependencies are present.                                |
| `edi_import_router`                  | One inbox for emailed and printed documents. It asks TypeSafe which document type each one is and files it accordingly.                |

The flow for one document looks like this:

```text
email to router alias ----+
                          +--> edi.import.router.document --> TypeSafe picks an exchange type
printed PDF (ERP Printer) +                                          |
                                                                     v
direct mail alias -----------------------------------------> edi.exchange.record
                                                                     |
                                                  exchange type's import template
                                                                     |
                                       extract text, match lines, create the Odoo record
```

The router is optional. If you only receive one kind of document from one sender, a direct alias on an exchange type is enough. The router earns its keep when many senders share one mailbox, or when some documents arrive as prints.

## Install the modules

`edi_import_router` depends on `import_from_email`, which depends on `base_import_pdf_by_template`, the engine module and `edi_core_oca`. The router also needs `mail` and `queue_job`. Those dependencies come from OCA repositories: `base_import_pdf_by_template` from [OCA/edi](https://github.com/OCA/edi), `edi_core_oca` from [OCA/edi-framework](https://github.com/OCA/edi-framework), and `queue_job` from [OCA/queue](https://github.com/OCA/queue). Install only what you need:

Email or printed documents routed automatically: `edi_import_router`.

Email to a fixed exchange type, no routing: `import_from_email`.

Structured PDF tables: `import_via_xberg`.

Template authoring tools: `import_preview`.

Creating vendors or products on the fly: `import_create_missing`.

Install by name from the Apps menu, or from the command line:

```
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">python</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo/odoo-bin</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-c</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo.conf</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-d</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">DB_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-i</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">edi_import_router,import_preview</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--stop-after-init</span>
```

Some modules need Python libraries available to Odoo's interpreter. `import_via_xberg` declares `jsonpath_ng` and `xberg`, and `edi_import_router` declares `typesafe_sdk` and `pypdf`. Install them before you install the modules.

Note

The router classifies each document in a `queue_job` job, so the job runner has to be running. The OCA [queue_job README](https://github.com/OCA/queue/tree/18.0/queue_job) says to load `queue_job` as a server-wide module (`server_wide_modules = web,queue_job`) and to restart Odoo after installing it on a database. Without a runner, routed documents never get classified.

## Set up a template

A template is the unit of work. Build one per sender and document layout. Create the template with the target model, an extraction mode and, optionally, an auto-detect pattern.

Choose the extraction mode by where the document comes from:

| Mode        | Source                                    | Notes                                                                                                                                                     |
| ----------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pypdf`     | A text-based PDF                          | Ships with `base_import_pdf_by_template`.                                                                                                                 |
| `plaintext` | An email body or text file                | Read back as UTF-8, unchanged.                                                                                                                            |
| `html`      | An HTML email body                        | Markup is stripped with Odoo's `html2plaintext`. Avunu adds a line break before every `<div>`, so a body built from nested divs keeps its line structure. |
| `xberg`     | A PDF (or other file) where tables matter | Produces a JSON document, described below.                                                                                                                |

Each template line is either a `header` line, which yields one value for the document, or a `lines` line, which yields one value per row of a repeating table. Every `lines` line with a pattern becomes one column. Columns are zipped together by position into rows.

Warning

Columns are paired by position, not by content. A column that matches fewer times than its siblings is padded with blanks rather than dropped, so later columns stay aligned, but a pattern that skips a row will still put values on the wrong row. Check the preview (below) against a real sample before you trust a table.

## Use xberg for tables

Flat text is a poor fit for a PDF table. The `xberg` mode parses the file into a structured document with real `tables[].cells[][]` grids and hands the template that JSON as its "page text". Install `import_via_xberg` and set the template's extraction mode to `xberg`.

### Narrow with JSONPath, then refine with regex

`pattern` is always a plain regular expression, on every template. On an `xberg` template each line also has an optional **Xberg JSONPath** field. When you set it, the regex runs only against what the JSONPath selects, one match per line of text. When you leave it blank, the regex searches the whole JSON document.

Work in two steps: write the JSONPath until it selects the right values, then write a regex that refines each one.

The following examples use a table shaped like the one in the module's tests, with header cells `QTY SHP`, `QTY B/O` and `ITEM`:

| Xberg JSONPath                      | Selects                       | Pattern               | Result                                                     |
| ----------------------------------- | ----------------------------- | --------------------- | ---------------------------------------------------------- |
| (blank)                             | The whole document            | `"lat":\s*"([\d.]+)"` | The first match in the raw JSON, as on any other template. |
| `$.tables[0].cells[1][2]`           | The cell `201P/90-0013`       | `(\d+)$`              | `0013`                                                     |
| `$.tables[0].cellsByHeader[*].ITEM` | The `ITEM` value of every row | `(\d+)$`              | One refined value per row.                                 |

To take a selected value as it is, use `(.+)` as the pattern.

### Read a table by header

A raw `cells` grid forces you to hardcode column positions, and positions shift when a sender reorders columns. So every table also gets two derived views next to `cells`, which is never modified:

`cellsByHeader` has one object per data row, keyed by that column's header text. Row 0 is treated as the header and is not included.

`cellsByIndex` has the same rows keyed by the column index as a string (`"0"`, `"1"`). Use it for a column with a blank header, or when two columns share a header.

Not every table has a header row. A label and value table such as `Order #:` beside its number has none, and both derived views come back empty for it. Use `cells` for those.

If a header wraps across two lines in the PDF, the key contains a newline. Type it as a backslash followed by `n` inside a quoted key:

```text
$.tables[1].cellsByHeader[*]['Part\n Number']
```

`\n`, `\t` and `\r` are supported.

Warning

Against the raw `cells` grid, a slice followed by a wildcard (`cells[1:][*][2]`) descends into the strings and yields single characters. Write `cells[1:].[2]` instead, or use `cellsByHeader` and avoid the slice.

### Tune the extraction

Two settings control how the file is parsed:

**Xberg configuration** on the template accepts a JSON object that is passed to the xberg library, for example `{"ocr": {"enabled": true}}`. Leave it blank for the defaults. See the xberg documentation for the full schema.

The system parameter `import_via_xberg.timeout` sets the extraction timeout in seconds. The default is `300`. A template's own configuration wins if it sets `timeout_secs`.

When a template could match any of several modes, Odoo tries every mode during auto-detection. The `xberg` mode is skipped when none of the candidate templates uses it, so you do not pay for a full parse on every upload.

## Preview while you write

Install `import_preview`. It adds a **Sample Data** tab to the template. Paste a sample document there, or upload a file and let the template's own extraction fill the field in. Uploading is the right choice for a PDF or an xberg template, because it stores exactly the text your patterns will see.

With a sample in place:

Each line dialog shows a **Preview** under `Pattern` that updates as you type. It runs the same extraction and conversion code as a real import, so dates, numbers and lookups behave the same way. A `lines` preview shows up to 25 values, and an invalid regex shows a warning instead of an error.

On an `xberg` template, the **Xberg JSONPath** field has its own preview, listing each numbered match. Check the narrowing step there before you write the regex.

The Sample Data tab shows a **Preview** of the whole template: the assembled header values and table rows. Misaligned columns show up here first.

On a header line with a **Search field**, a lookup that finds nothing is called out. This is the most common template mistake, because the import otherwise falls back to the raw text silently.

One caveat: if you paste sample data and open an existing line without saving the template first, the first render can be stale. It corrects itself on your next keystroke in the dialog.

## Route email into Odoo

The mail side has two options. Both file the document as an `edi.exchange.record`, which is a tracked, retryable EDI record.

### Option 1: a direct alias

Use this when a mailbox always carries one document type.

Create the input `edi.exchange.type`. Set **Processor** to "EDI Input Process: Import by Template" and **Import Template** to your template.

Enable `quick_exec` on the type if you want processing to start immediately. `import_from_email` makes this checkbox visible on input types, where the stock view hides it.

Create a `mail.alias` pointing at `edi.exchange.record`, and set its defaults to a Python dict literal naming the backend and the exchange type code:

```
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">{</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">'backend_id'</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">: </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">BACKEND_ID</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">, </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">'type_code'</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">: </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">'<TYPE_CODE>'</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">}</span>
```

`backend_id` and `type_code` are keys in the alias's defaults text, not fields you will find on the record. A message routed there without both keys raises an error instead of creating a half-valid record.

The raw HTML body is stored unchanged as the exchange file and the record starts in the `input_received` state, since the whole document has already arrived. Interpretation is the template's job, so use an `html` or `plaintext` template. Every inbound email becomes its own record, even when a mail client threads several forwards under one subject.

The generic processor reads the template from the exchange type, extracts the text, and creates the target record through the same form-driven engine a manual upload uses. It then links the record to the exchange record.

Note

The generic processor creates records and nothing else. A document that needs fuzzy partner or product matching, safe updates to an existing record, or de-duplication deserves its own dedicated processor on its exchange type. Both kinds can coexist on one backend.

### Option 2: the import router

Use `edi_import_router` when several senders share one inbox, when staff forward vendor mail by hand, or when a document only exists as a printout.

In **Settings**, enter the TypeSafe API key, or set the `TYPESAFE_API_KEY` environment variable. TypeSafe is a hosted AI service that the router calls through the `typesafe_sdk` Python package, so Odoo needs outbound internet access. With no key, every document waits for manual review.

Create an input exchange type and template for each document type, as in option 1.

Open **Import Routing**, then **Import Routers** (under the EDI menu), and create a router. Give it an email alias, a responsible user, and one target per exchange type.

Write each target's **Description** to say what tells that document apart: the sender, the subject or title, distinctive text. TypeSafe chooses between these descriptions, so name the difference explicitly when two vendors send from the same address.

A target can be limited to email or to printed documents. Whatever you choose, a document is only offered to a type whose template can read it: an email body needs an `html` or `plaintext` template, and a PDF needs a PDF template. Pointing a printer-only target at a body template is rejected.

Each arriving document becomes an `edi.import.router.document` and a background job (`queue_job`) classifies it, so neither the mail gateway nor the printer waits on the API. The job sends TypeSafe up to 8000 characters of the email body or PDF text, along with the subject, the sender and the original sender found in a forwarded header. The router's **Question** field holds the instruction text, and its default already explains that forwarded copies of a vendor document are that document.

The outcome depends on two thresholds on the router:

| Setting              | Default | Meaning                                                                                     |
| -------------------- | ------- | ------------------------------------------------------------------------------------------- |
| Confidence threshold | `0.8`   | A document is filed automatically only when TypeSafe is at least this sure.                 |
| Ignore threshold     | `0.98`  | A document is ignored only when TypeSafe answers "none" with at least this much confidence. |

The ignore threshold is stricter on purpose, because a wrongly ignored order costs more than an extra review item. A confident match is filed with the same `create_record()` call that `import_from_email` uses. A document that TypeSafe doubts, or that fails, lands in `review` with a to-do for the responsible user. Rate limits and connection errors are retried up to three times, 60 seconds apart, before a person is asked.

Reviewers open **Routed Documents**, which is filtered to documents needing review by default. Each document shows its state (`pending`, `routed`, `review`, `ignored` or `error`), TypeSafe's confidence and per-target probabilities, and the resulting exchange record. Three buttons handle the rest: **Dispatch** files it under the target you picked, **Re-classify** asks again, and **Ignore** closes it.

Two access groups exist. **Import router reviewer** can read the router and work on documents. **Import router: printer upload** can attach a PDF to a router and nothing else.

### Forwarding from Gmail

A forwarding rule matches the router alias only if Odoo sees the alias as a `Delivered-To` recipient. When mail arrives through the Cloudflare module, the envelope recipient has to be added even if the message already carries a `Delivered-To` from the forwarder. The Avunu `mail_cloudflare` module in the same repository handles that inbound path.

### Printed documents

A quote that only exists on a web page can be printed to PDF and uploaded by ERP Printer.

Create an Odoo user in the **Import router: printer upload** group, with an API key.

On the ERP Printer profile, set the backend to `OdooJsonRpc` (Odoo 18), the Odoo model to `ir.attachment`, **Attach to model** to `edi.import.router`, and **Attach to record ID** to the router's ID.

The router form shows these values in a read-only line. The upload becomes a `print` document and is classified like an email. Files with identical contents are ignored, so a retry from the printer's outbox never files a document twice.

## Create missing records

By default, if a line's search finds no vendor or product, the import falls back to the line's fixed value or the raw text. `import_create_missing` can create the missing record instead.

On a template line whose **Field** is a many2one with a **Search field** set, check **Create New Document if Not Found**.

Open the **New Document Values** tab. It fills itself with every field the new record requires. Fields with no Odoo default appear as empty `Variable` rows, and fields with a default appear as `Fixed` rows already set to that default.

Fill the empty rows, and adjust any default you do not want. Add rows for anything else the record should carry.

Import a document whose value will not be found.

Each row sets one field and has a **Type**:

**Fixed**: always the same value, entered with an input that matches the field's type.

**Variable**: extracted with a regex, evaluated once per table row (or once for a header line), in the same order as the line's own values.

**Odoo Default**: left out of the create, so Odoo applies its own default. This suits a field that means "now".

The search value that missed is written into the new record's search field, so importing the same source again finds the record instead of duplicating it.

Rows are paired with the line's rows by position. If a row's pattern produces a different number of matches than the line itself, no record is created for any row of that line, and the reason is logged. Positions are never guessed.

If the field you are filling is a one2many, such as a vendor's bank accounts or a product's vendor list, its Type, Value and Pattern are replaced by a **Row Values** table for the sub-record's own fields. A product line always offers a **Vendors** row, because a product created without one can never be found by vendor code again.

A row whose required field is still empty is highlighted and labelled **Missing**, and the tab shows a banner. The warning is advisory. The line still saves, so you can build a template over several sittings. **Add Required Fields** appends what is missing without touching rows you edited.

Note

Records are only created during a real import, from a manual upload or from the EDI intake. A preview, whether the line dialog or the standalone preview wizard, never creates anything.

On an `xberg` template, `import_create_missing_xberg` adds a **JSONPath** field to each Variable row. Use the same table the line reads, for example `$.tables[1].cellsByHeader[*]['Description']` to fill a name from the Description column of the row where the line found a part number. A row's pattern is optional here, and when set it runs against each JSONPath match on its own. A blank match stays blank at its position, so one empty cell never shifts the rows after it. A Variable row that has a pattern but no JSONPath of its own searches the whole JSON document, and the warning banner names it.

## Troubleshooting

| Symptom                                          | Likely cause                                                                                                                                                                                                    |
| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| A message to a direct alias raises an error.     | The alias defaults lack `backend_id` or `type_code`.                                                                                                                                                            |
| An EDI record never processes.                   | The type has `quick_exec` on but the record is not in `input_received`. Records created by these modules already are.                                                                                           |
| HTML tags show up in the text your patterns see. | An HTML email body is being read by a `plaintext` template. Use `html`.                                                                                                                                         |
| Every document goes to review.                   | No TypeSafe API key is set, or confidence is below the router's threshold. Read the document's error message.                                                                                                   |
| A document says no target can read it.           | The targets' templates cannot read that source, such as only body templates for a printed PDF.                                                                                                                  |
| A creation is skipped for a whole table.         | A New Document Values column matched a different number of times than the line. Fix the pattern.                                                                                                                |
| A record was not created and no error is shown.  | Turn on developer mode, open **Settings**, **Technical**, **Logging** and filter by Path `import_create_missing`. Entries are written on their own database cursor so a rolled-back import does not erase them. |
| An xberg preview says to add a sample.           | The template has no sample document yet. Upload one on the Sample Data tab.                                                                                                                                     |

## What this document does not cover

This document does not describe the base module's own screens, such as the manual upload wizard and the template list, because that module is not part of Avunu's repositories. Menu and field labels here come from the Avunu modules' own views. Test commands for each module are in its README, and run with `--test-enable --test-tags /<MODULE_NAME>`; [Testing Custom Odoo Modules](/kb/odoo/testing-custom-odoo-modules/) explains the options.

## Related documents

[Odoo Community and OCA Overview](/kb/odoo/odoo-community-and-oca-overview/)

[Odoo Development Environment](/kb/odoo/odoo-development-environment/)

[Two-Way SMS in Odoo with Twilio](/kb/odoo/two-way-sms-in-odoo-with-twilio/)

Sources

- [github.com/Avunu/edi-addons](https://github.com/Avunu/edi-addons)
- [github.com/Avunu/edi-addons/tree/18.0/edi_import_router](https://github.com/Avunu/edi-addons/tree/18.0/edi_import_router)
- [github.com/Avunu/edi-addons/tree/18.0/import_from_email](https://github.com/Avunu/edi-addons/tree/18.0/import_from_email)
- [github.com/Avunu/edi-addons/tree/18.0/import_via_xberg](https://github.com/Avunu/edi-addons/tree/18.0/import_via_xberg)
- [github.com/Avunu/edi-addons/tree/18.0/import_preview](https://github.com/Avunu/edi-addons/tree/18.0/import_preview)
- [github.com/Avunu/edi-addons/tree/18.0/import_create_missing](https://github.com/Avunu/edi-addons/tree/18.0/import_create_missing)
- [github.com/Avunu/edi-addons/tree/18.0/base_import_pdf_by_template_engine](https://github.com/Avunu/edi-addons/tree/18.0/base_import_pdf_by_template_engine)

Need help with Odoo?

Our notes can take you a long way, but sometimes you'd rather have someone who's done it before.

[Odoo implementation](/services/erp/odoo/)

[← PreviousA repair shop workflow on Odoo 18, from inspection to invoice](/kb/odoo/repair-shop-workflow-on-odoo/)[Next →Migrating from QuickBooks to Odoo with a clean cutover](/kb/odoo/migrating-from-quickbooks-to-odoo/)

CC0This article is in the public domain ([CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/)), code samples included. Use it however helps you.

On this page

- [How the pieces fit](#how-the-pieces-fit)
- [Install the modules](#install-the-modules)
- [Set up a template](#set-up-a-template)
- [Use xberg for tables](#use-xberg-for-tables)
- [Narrow with JSONPath, then refine with regex](#narrow-with-jsonpath-then-refine-with-regex)
- [Read a table by header](#read-a-table-by-header)
- [Tune the extraction](#tune-the-extraction)
- [Preview while you write](#preview-while-you-write)
- [Route email into Odoo](#route-email-into-odoo)
- [Option 1: a direct alias](#option-1-a-direct-alias)
- [Option 2: the import router](#option-2-the-import-router)
- [Forwarding from Gmail](#forwarding-from-gmail)
- [Printed documents](#printed-documents)
- [Create missing records](#create-missing-records)
- [Troubleshooting](#troubleshooting)
- [What this document does not cover](#what-this-document-does-not-cover)
- [Related documents](#related-documents)

[Back to top↑](#top)

Services

- [ERP implementation](/services/erp/)
- [Odoo](/services/erp/odoo/)
- [ERPNext](/services/erp/erpnext/)
- [Custom software](/services/custom-software/)
- [Devices & IoT](/services/devices-iot/)
- [Websites](/services/websites/)
- [Infrastructure](/services/infrastructure/)

Resources

- [Our work](/work/)
- [Open source](/open-source/)
- [Knowledge base](/kb/)
- [Insights](/insights/)

Company

- [About](/about/)
- [Team](/about/team/)
- [Partners](/partners/)
- [Contact](/contact/)

Clients

- [Project portal](https://erp.avunu.net/projects)
- [Invoices](https://erp.avunu.net/)
- [Support](https://erp.avunu.net/)

[![Avunu](/brand/avunu-logo-light.svg)](/)[\<av-icon data-jx-static>\<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" stroke="none" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\<path d="M20.400 20.500h-3.600v-5.600c0-1.300 0-3-1.800-3s-2.100 1.400-2.100 2.900v5.700H9.400V9h3.400v1.600c.5-.9 1.600-1.900 3.400-1.900 3.600 0 4.300 2.400 4.300 5.500v6.300zM5.300 7.400a2.100 2.100 0 1 1 0-4.100 2.100 2.100 0 0 1 0 4.100zm1.800 13.100H3.600V9h3.500v11.500zM22.200 0H1.800C.8 0 0 .8 0 1.700v20.600c0 .9.800 1.700 1.800 1.700h20.400c1 0 1.800-.8 1.800-1.700V1.700C24 .8 23.200 0 22.200 0z">\</path>\</svg>\</av-icon>](https://www.linkedin.com/company/avunu)[\<av-icon data-jx-static>\<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" stroke="none" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\<path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.500 11.500 0 0 1 6 0c2.300-1.500 3.300-1.200 3.300-1.200.6 1.700.2 2.900.1 3.200.8.8 1.200 1.900 1.200 3.200 0 4.600-2.800 5.600-5.500 5.900.4.400.8 1.100.8 2.200v3.300c0 .3.2.7.8.6A12 12 0 0 0 12 .3">\</path>\</svg>\</av-icon>](https://github.com/Avunu)[Client portal](https://erp.avunu.net/projects)[Start a project](/start/)

Avunu LLC · 948 East Philadelphia Street, York, PA 17403 · (717) 814-8540Knowledge base articles are in the public domain[Privacy](/privacy/)[Terms](/terms/)
