简介
Drivethru Odoo
原始描述
Talk to an Odoo ERP through its `drivethru_mcp` MCP server — discover the available Odoo tools at runtime and call them to look up eBay products/inventory, p...
通过你的 Agent 添加
安装目录:drivethru-odoo/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: drivethru-odoo
description: Talk to an Odoo ERP through its drivethru_mcp MCP server — discover the available Odoo tools at runtime and call them to look up eBay products/inventory, push eBay orders and read tracking, run the Accounts Payable PO→vendor-bill flow, review documents in the Documents app against their purchase orders and fix incorrect PO line pricing (the "check the Purchasing folder against the POs" / vendor-invoice pricing-review workflow, filing each document into Matched or Questions), schedule MRP production batches, drive vendor replenishment purchasing (run the replenishment report → curate lines → add to a PO → hand style/color/size/qty to the vendor's purchasing skill → write pricing + confirmation back and confirm the PO), and retrieve internal SOPs / best practices / policies from the Knowledge base scoped to the asking person's permissions. Use whenever the user needs to read from or write to Odoo, especially when you are answering a person inside an Odoo Discuss conversation.
version: 0.5.0
emoji: 🏭
homepage: https://www.odoo.com
metadata:
openclaw:
requires:
env: [ODOO_MCP_URL, ODOO_MCP_TOKEN]
bins: [python3]
primaryEnv: ODOO_MCP_TOKEN
envVars:
ODOO_MCP_URL:
required: true
description: >
Full URL of the Odoo MCP endpoint, e.g.
https://odoo.example.com/drivethru_mcp/v1 (note the path — this is
the MCP server exposed by the drivethru_mcp Odoo module, not the
Odoo base URL).
ODOO_MCP_TOKEN:
required: true
description: >
The drivethru.mcp_key value from the Odoo drivethru_mcp module,
sent as Authorization: Bearer. Treat as a secret; never paste into
chat.
install:
uv:
- mcp>=1.9.0
- pypdf>=4.0 # local PDF text extraction for the PO pricing-review intake (scripts/po_docs.py)
Odoo Drive Thru MCP integration
This skill connects to the Odoo drivethru_mcp module's MCP server
(POST $ODOO_MCP_URL, a Streamable-HTTP MCP endpoint) and lets you use its
tools on the user's behalf. Unlike a static API wrapper, the tool surface is
discovered at runtime — call tools to see exactly what this Odoo exposes.
The core helper script is scripts/odoo_mcp.py:
# Discover the available tools (name + description + JSON input schema)
python3 scripts/odoo_mcp.py tools
# Call a tool — arguments are a JSON object as the 2nd arg or on stdin
python3 scripts/odoo_mcp.py call <tool_name> '{"...": "..."}'
echo '{"...": "..."}' | python3 scripts/odoo_mcp.py call <tool_name>
Every invocation prints one JSON object on stdout, or
{"error": {"type": ..., "message": ...}} with a non-zero exit on failure.
scripts/po_docs.py is a task-specific helper for the PO pricing review: it
lists a Documents-app folder over the same endpoint and returns each file's
extracted text (never base64 or a page render), so a many-document run
doesn't fill the context window — plus a move action to file a reviewed
document into Matched/Questions. See the pricing-review section below.
Required credentials
ODOO_MCP_URL and ODOO_MCP_TOKEN must be in the environment. If either is
missing the script exits with {"error": {"type": "config_error", ...}} (exit
2) — stop and tell the user to configure them. Secrets come from the
environment; never ask the user to paste the key into chat.
Always start with tools
The MCP server's tools/list is the source of truth for tool names and their
exact input schemas — run python3 scripts/odoo_mcp.py tools first and read
the inputSchema for any tool before calling it. The current Odoo exposes these
tool groups (names may evolve — trust tools over this list):
| Domain | Representative tools |
|---|---|
| eBay | ebay_list_products, ebay_inventory, ebay_create_order, ebay_order_tracking |
| Accounts Pay | ap_search_purchase_orders, ap_get_purchase_order, ap_update_po_lines, ap_create_vendor_bill, ap_get_vendor_bill, ap_search_vendors; PO chatter: po_post_message, po_get_messages |
| Documents app | documents_list_folders, documents_search, documents_get, documents_create, documents_update, documents_post_message — folders/files, chatter, and activities (the door to the Purchasing folder for the PO pricing review) |
| Production | production_overview, production_schedule_queue, production_list_batches, production_get_batch, production_batch_supply, production_schedule_batch, production_plan_batch, production_bulk_schedule, production_list_workcenters, production_get_workcenter, production_list_production_centers, production_list_decoration_methods |
| Mfg data (read-only) | mfg_list_models, mfg_fields, mfg_read — read ALL fields on any whitelisted manufacturing model (batches, POs, receipts, decorations, tracking, …) |
| Replenishment / Purchasing | replenish_run_report, replenish_get_orderpoint, replenish_to_po, replenish_update_po, replenish_confirm_po, po_post_message, po_get_messages |
| Internal knowledge (SOPs, best practices) | knowledge_search_articles, knowledge_get_article — permission-scoped to the asking person |
| Operator docs | docs_list, docs_get — fetch the operator reference for deeper context |
For a full production-scheduling pass (rank the queue → check receipts → place
batches on machines, never starting before goods are received), use the
dedicated drivethru-production-scheduler skill, which drives these same
tools.
Working inside an Odoo Discuss conversation
You are often answering a person in an Odoo Discuss DM (your messages are
posted straight back into their thread). The bridge prefixes each forwarded
message with a fenced [Conversation context] block that names the person
and gives their Odoo user_id. Lift that user_id out and pass it to the
knowledge_* tools so internal-knowledge answers are scoped to what this
person is allowed to see (details below). If the context says the sender has no
linked Odoo user, don't guess a user_id — the knowledge tools can't be used
for them. So:
- Be concise and conversational. Reply in plain prose, not raw JSON dumps — summarize what the tools returned. Surface a tool error's human-readable message rather than the raw envelope.
- Ask for missing information instead of guessing identifiers. If you need a PO, batch, or order id, look it up with a search/list tool first.
- Confirm before writes. Creating orders/bills, updating prices, and scheduling/planning batches change live Odoo data. State exactly what you're about to do and get the user's go-ahead before calling a write tool.
- Use
docs_list/docs_getwhen you need the operator-level rules behind a workflow (e.g. how vendor-bill matching or batch scheduling is meant to work).
Typical flows
- "What eBay inventory do we have for A-1, B-2?" →
ebay_inventory
{"skus": ["A-1", "B-2"]}.
- "Find the PO for vendor X and bill it." →
ap_search_purchase_orders →
ap_get_purchase_order → (confirm) → ap_create_vendor_bill.
- "Check the docs in the Purchasing folder against the POs and fix the pricing."
→ the document-driven PO pricing-review flow below.
- "Show the production plan and schedule batch 142 onto workcenter 3." →
production_overview → production_get_batch {"batch_id": 142} → (confirm)
→ production_schedule_batch
{"batch_id": 142, "primary_workcenter_id": 3, "date_planned_start": "..."}.
- "Purchase all Adidas items for Batch12345." → the replenishment → purchasing
flow below.
- "What's our SOP for reprinting a damaged order?" → the internal-knowledge
flow below (
knowledge_search_articles → knowledge_get_article).
Internal knowledge retrieval (SOPs, best practices, policies)
ebay_inventory
{"skus": ["A-1", "B-2"]}.ap_search_purchase_orders →
ap_get_purchase_order → (confirm) → ap_create_vendor_bill.production_overview → production_get_batch {"batch_id": 142} → (confirm)
→ production_schedule_batch
{"batch_id": 142, "primary_workcenter_id": 3, "date_planned_start": "..."}.knowledge_search_articles → knowledge_get_article).You double as an internal operations knowledge agent. When someone asks a "how do we…", "what's our policy on…", or "what's the SOP for…" question, answer it from the Odoo Knowledge base rather than from memory — and only from articles that person is allowed to see.
Two tools, both permission-scoped to the asking person's user_id (which
you take from the [Conversation context] block, see above):
- Search.
knowledge_search_articles{"user_id": <ctx uid>, "query": "reprint damaged order"}— free text matches title + body;root_only/parent_idwalk the article tree. Only articles this user may read come back (each with a breadcrumbpath,snippet, andurl). - Read in full.
knowledge_get_article{"user_id": <ctx uid>, "article_id": <id>}— returns the article's plain-textbodyplus metadata. Answer from this, not from the snippet.
Permission handling. The tools query Odoo as that user, so access is
enforced by Odoo's own rules — you don't manage permissions yourself. If
knowledge_get_article returns accessible: false, the person simply doesn't
have access to that article: tell them that plainly (offer to point them to
whoever owns it), and don't try to work around it or read it as anyone
else. Never pass a user_id you weren't given in the conversation context.
When you answer, summarize the SOP/policy in plain prose and cite the article
title (and url when present) so the person can open the source. Read
docs_get {"slug": "knowledge"} for the operator-level rules behind this.
Document-driven PO pricing review (Purchasing folder)
When asked to "go through the Purchasing folder and check each document's pricing against the PO, fix any wrong lines, mark the PO checked, and file the document" (vendor order confirmations / acknowledgements / invoices), own the whole loop. This runs many times a day over many documents, so two rules are non-negotiable:
-
Don't bloat the context window.
documents_getreturns each file as base64 and a PDF reader adds a page image — huge next to the ~300–600 chars of text that matter. Extract text out of context, once, with the intake helper instead of loopingdocuments_get/a PDF reader over the folder:python3 scripts/po_docs.py extract '{"folder": "Purchasing"}'It fetches every file over the same MCP endpoint, decodes and extracts the text locally, and returns compact JSON (
documents[].text, no base64, no render). Read that. Only fall back todocuments_getfor a document the helper marksneeds_vision: true(scanned/image-only), one at a time. -
Every document ends in Matched or Questions. The Purchasing folder has sibling subfolders
MatchedandQuestions; nothing stays in the inbox.
Per document: read the PO# from the text (not the filename — filenames may
carry the vendor's order number), then ap_search_purchase_orders →
ap_get_purchase_order, pair each line by (style, color, size), compare
price_unit, and batch every fix into one ap_update_po_lines. Totals are a
cross-check only — a shipment acknowledgement is often one box of a
multi-shipment order, so a total gap explained by un-shipped lines is not a
discrepancy. Post a "checked" note with po_post_message. Then file it:
# reconciled (matched, or corrected with confidence)
python3 scripts/po_docs.py move '{"document_id": <id>, "to": "Matched", "under": "Purchasing"}'
# a real question — raise it on the document, assign Zach, then file to Questions
documents_post_message {"document_id": <id>, "body": "<question>", "activity_user": "Zach Tucker"}
python3 scripts/po_docs.py move '{"document_id": <id>, "to": "Questions", "under": "Purchasing"}'
Only escalate a genuine ambiguity (unreadable PO#, prices that don't reconcile, unexpected/missing lines, wrong vendor). An unambiguous fix backed by the vendor document is a Matched correction, not a question.
Full procedure, matching rules (partial shipments, freight/fees, PO#-from-body),
a worked example, and a low-cost model recommendation for running this at
volume are in
references/po_pricing_review.md.
Replenishment → vendor purchasing
When the user asks you to buy what the replenishment report says to buy for
a vendor (e.g. "Purchase all items from Adidas for Batch12345"), you own the
whole loop: read the report, curate the lines, put them on a PO, drive the
vendor's checkout, then write the result back and confirm. The
drivethru_mcp tools handle the Odoo side; a separate vendor purchasing
skill handles the actual buying.
Run it in this order — confirm the curated set with the user before you replenish, and again before you confirm the PO (both are live writes):
- Run the report.
replenish_run_reportwith the vendor filter (e.g.{"vendor": "Adidas"}). It rebuilds the replenishment report and returns the shortage lines withstyle/color/size/qty_to_order/price/production_batch_name/sale_order_name/is_out_of_stock. - Curate. Keep only the lines the request calls for — "for Batch12345"
means keep lines whose
production_batch_namematches; "all Adidas" means keep them all. This filtering is your responsibility. Show the user the kept lines (style/color/size/qty) and get a go-ahead. - Add to a PO.
replenish_to_po{"orderpoint_ids": [...]}. This runsaction_replenishand returns the draft PO(s) with each line'sline_id+ style/color/size/product_qty. Anything that couldn't be bought (manufacture route, held sales order) comes back underwarnings— surface it. - Find the vendor skill & purchase. Locate the vendor's purchasing skill —
named
drivethru-<vendor>-click(e.g.drivethru-adidas-click) — and read itsSKILL.md. For adidas that's a CLI:echo '{...}' | python3 scripts/adidas.py create-purchase-order, taking{purchase_order: {po_number, lines:[{style, size, quantity}]}, confirm}(map the Odoo POname→po_number; color is optional — the adidas article encodes it). Dry-run first (confirm: false), show the user, thenconfirm: trueplaces a real order. If no such skill exists, stop and tell the user; do not invent a checkout. - Write back. Take the skill's result — match each result line to its Odoo
PO line by (style, size) to get the
line_id, parse the$-prices to numbers — and apply it withreplenish_update_po:price_unitperline_id,vendor_order_number← theconfirmation_number. - Handle out-of-stock / exceptions. The adidas skill pauses on a line it
can't fill and returns
status: "needs_confirmation"without_of_stock. On that,po_post_messageonto the PO withissue_type: "out_of_stock"and anactivity_user_idso purchasing/sales sees it — then pause that PO.po_get_messageslater to read the reply, then re-run the vendor skill with the chosen policy (on_insufficient_stock: "order"/"skip", or edited lines to substitute). Do not confirm a PO with an unresolved issue. - Confirm. Once pricing is written and there are no open issues,
replenish_confirm_po. It confirms without re-submitting to the vendor (the buy already happened via the skill).
The full hand-off contract (the exact dataset shape you pass the vendor skill
and the result shape you expect back) is in
references/replenishment_purchasing.md.
Read docs_get {"slug": "replenishment"} for the operator-level rules.
Errors
config_error (exit 2) — ODOO_MCP_URL / ODOO_MCP_TOKEN missing.
invalid_arguments (exit 2) — bad CLI usage or non-JSON arguments.
connection_error — Odoo unreachable, transport error, or the key was
rejected (the MCP server requires a valid key even to list tools).
- A tool that ran but failed returns a normal MCP result with
isError: true
and a human-readable message in its content — surface that to the user.
References
references/agent_api_endpoints.md — the
underlying Odoo operations (now exposed as MCP tools); tools/list is
authoritative for the live schema.
references/production_scheduling.md —
the MRP data model behind the production tools.
references/replenishment_purchasing.md —
the replenishment → vendor-purchasing loop and the vendor-skill hand-off
contract (dataset in, result out).
Legacy REST scripts (deprecated)
config_error (exit 2) — ODOO_MCP_URL / ODOO_MCP_TOKEN missing.invalid_arguments (exit 2) — bad CLI usage or non-JSON arguments.connection_error — Odoo unreachable, transport error, or the key was
rejected (the MCP server requires a valid key even to list tools).isError: true
and a human-readable message in its content — surface that to the user.references/agent_api_endpoints.md— the underlying Odoo operations (now exposed as MCP tools);tools/listis authoritative for the live schema.references/production_scheduling.md— the MRP data model behind the production tools.references/replenishment_purchasing.md— the replenishment → vendor-purchasing loop and the vendor-skill hand-off contract (dataset in, result out).
Legacy REST scripts (deprecated)
scripts/sales.py, scripts/ap.py, scripts/production.py, and
scripts/odoo_client.py are the previous REST wrappers for the old agent_api
module. They still work against the drivethru_mcp module's REST back-compat
routes (/agent_api/v1/*) but are deprecated — prefer scripts/odoo_mcp.py.
They will be removed once all deployments are on the MCP surface.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。