Document Chaos in ERP
Companies upload thousands of documents to Odoo — invoices, contracts, receipts, specifications, certificates. Without proper classification, finding the right document becomes a needle-in-a-haystack problem. AI classification automatically organizes documents as they arrive.
Classification Categories
# AI document classification types:
# Financial:
# - Invoice (vendor/customer)
# - Receipt/expense
# - Bank statement
# - Tax certificate
# - Financial report
# Legal:
# - Contract/agreement
# - NDA
# - Terms of service
# - Power of attorney
# Operations:
# - Purchase order
# - Delivery note
# - Packing slip
# - Quality certificate
# HR:
# - Resume/CV
# - ID document
# - Employment contract
# - Performance review
# Technical:
# - Product specification
# - Technical drawing
# - User manual
# - Safety data sheet (SDS)How Classification Works
# AI Document Classification Pipeline:
# 1. Document uploaded to Odoo (Documents module)
# 2. Extract text:
# - PDF: text extraction or OCR
# - Image: OCR (Tesseract/Cloud Vision)
# - Office docs: python-docx/openpyxl
# 3. AI analyzes content:
# - Document type classification
# - Entity extraction (dates, amounts, names)
# - Language detection
# 4. Apply classification:
# - Set document tag
# - Move to correct workspace/folder
# - Link to Odoo record (partner, project, etc.)
# 5. Notify relevant teamOdoo Integration
# Automated action on document creation:
def classify_document(document):
# Extract text from attachment
text = extract_text(document.attachment_id)
# AI classification
result = ai_classify_document(text)
# Apply classification
tag = env['documents.tag'].search([
('name', '=', result['document_type'])
], limit=1)
folder = env['documents.folder'].search([
('name', '=', result['folder'])
], limit=1)
document.write({
'tag_ids': [(4, tag.id)] if tag else [],
'folder_id': folder.id if folder else document.folder_id.id,
})
# Extract and link metadata
if result.get('partner_name'):
partner = env['res.partner'].search([
('name', 'ilike', result['partner_name'])
], limit=1)
if partner:
document.partner_id = partner.id
# Extract key data
if result['document_type'] == 'invoice':
document.write({
'res_model': 'account.move',
'description': f"Amount: {result.get('amount')}"
f"\nDate: {result.get('date')}"
f"\nVendor: {result.get('vendor')}",
})Metadata Extraction
# AI extracts structured data:
# Invoice → amount, date, vendor, invoice number
# Contract → parties, start/end date, value
# Receipt → amount, date, merchant, category
# Resume → name, skills, experience, education
# PO → order number, items, quantities, supplier
# Extracted data stored as document metadata
# Enables searching by extracted fields
# Auto-links to matching Odoo recordsBulk Classification
# Classify existing untagged documents:
def bulk_classify():
untagged = env['documents.document'].search([
('tag_ids', '=', False),
('attachment_id', '!=', False),
])
for doc in untagged:
try:
classify_document(doc)
except Exception as e:
doc.write({
'description': f'Classification failed: {e}'
})
return f'Classified {len(untagged)} documents'DeployMonkey AI
DeployMonkey's AI agent can set up document classification workflows in Odoo. Automatically organize your document workspace with zero manual tagging.