Document intelligence
Document intelligence lets an outside AI program turn a PDF or a photo of a document into a draft record in Odoo. The document must already be attached in Odoo. The draft can be a vendor bill, a sales order or a purchase order. A person always decides before anything is created.
Who this is for: administrators who connect outside AI programs.
You need: Edition: Business (module minddesk_mcp_document). It also needs MitDesk Pro, Accounting (invoicing), Sales and Purchase. See Editions.
Two tools
| Tool | What it does |
|---|---|
propose_document_record |
Reads the document and returns the values it would use. It also returns a list of what it could not find. It writes nothing to Odoo. |
create_document_draft |
Creates one draft record from the proposal. It always stops for a person to approve. It never runs alone. |
create_document_draft does not trust the proposal that is sent back to it. It keeps only fields it knows for the target, and drops all others:
- All targets: partner, document date, reference and lines.
- Vendor bill only: currency and due date. The type is always a vendor bill.
- A line has product, description, quantity and unit price. Orders also keep the unit of measure. A purchase order also keeps the planned date.
Every partner, currency, product and unit is checked again. It must still exist, the user must be allowed to read it, and it must belong to the company of the key. Nothing is posted, confirmed or validated. The result is only a draft.
Set it up
- Install
minddesk_mcp_document. - Open Configuration ▸ MCP ▸ Document intelligence and create the profile for your company. There is one profile for each company.
- Pick the Vision / OCR Model. The Provider class is shown from the model.
- Leave Allow document data to cloud models off, unless your company has decided otherwise.
- Give the key the rights it needs (see below).
Without an active profile, or if its model is archived, propose_document_record says that document intelligence is not configured. create_document_draft does not read the profile.
What a key needs
- Read scope on
ir.attachment,res.partner,res.currency,product.productanduom.uom. - The content of attachments must not be blocked on the key. It is blocked under four names:
ir.attachment.datas,.raw,.db_datasand.index_content. Blocking any of them keeps the file closed. - Create scope on the target model. This is needed already for the proposal, so a key that could never create the draft cannot use the tool to read the document.
See Keys and scopes.
How a document is read
MitDesk accepts PDF files up to 16 MiB, and PNG or JPEG images up to 8 MiB. Other files are refused.
MitDesk first tries to read the text on your own server:
- For a PDF, it uses the text inside the PDF. This needs a PDF reader package (
pdfplumberordocling) on the server. - If there is no text, it uses OCR (text recognition) on the server. OCR is also used for PNG and JPEG images. No OCR program ships with MitDesk. Install
pytesseract(with Tesseract),easyocrorpaddleocron the server. - If the server cannot read a scan, MitDesk uses the Document reader if one is set. You set it in Settings ▸ MitDesk ▸ Document reader. It must be an active model on an OpenAI-compatible endpoint, hosted on your own server or in the EU, with document input.
- If nothing can read the scan, the tool answers "unreadable". It says why and what to install. It does not send the scan to the profile's model.
The text is cut after about 100 KB (102,400 characters). It is given to the profile's model as untrusted data, with the order to ignore any instruction inside it.
If the server has no PDF reader package at all, a PDF without a Document reader goes to the profile's model as a whole file. This needs the cloud approval below if the model is not local. The answer says why.
Cloud approval
If the model that reads documents, or the Document reader, is not on your own server, two things must be true:
- Allow document data to cloud models is on in the profile. If not, the call is refused with "cloud document analysis is disabled by the company administrator". The ceiling of the document's own company also counts.
- The program repeats the call with
confirm_cloud_egress: true. Without it, the tool does nothing. It answerscloud_confirmation_requiredwith a warning that the document may hold personal, financial or confidential data, and says what to repeat.
The setting in the profile is only a ceiling. It is not consent for one document. Both steps are needed each time. The routing rules also apply.
Exact matches only
MitDesk does not guess. It looks for exactly one match:
- Partner: the exact VAT number. If there is none, the exact e-mail address (upper and lower case do not matter). The partner must belong to the company or to nobody.
- Currency: the exact ISO code, among active currencies.
- Product: the exact internal reference of the line.
If there is no unique match, the field is left out of the proposal. An entry in the list unresolved names the field, the text that was read and the reason. A person fills it in when reviewing the draft. MitDesk creates no new partner and no new product. Only the first 200 lines are proposed. Others are reported in the same list.
MitDesk never proposes taxes, accounts, journals or payment data.
If it does not work
For general problems, see Troubleshooting.