获取Odoo客户数据并导出为JSON或Excel
高级
这是一个CRM领域的自动化工作流,包含 18 个节点。主要使用 If, Code, Odoo, Webhook, Function 等节点。 获取Odoo客户数据并导出为JSON或Excel
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "6b3e8c6c30cdfbf06283a3fa57016932c6b4ec959896c5c546ef5865ff697ff1"
},
"nodes": [
{
"id": "752a1ab6-274c-4f09-9bf1-e2dba414aaf1",
"name": "接收公司请求1",
"type": "n8n-nodes-base.webhook",
"position": [
-816,
3152
],
"webhookId": "get-companies-uuid",
"parameters": {
"path": "/api/v1/get-customers",
"options": {},
"responseMode": "responseNode"
},
"typeVersion": 2.1
},
{
"id": "66762aac-2d62-4d59-9956-816476d0f92f",
"name": "准备动态过滤器1",
"type": "n8n-nodes-base.function",
"position": [
-576,
3152
],
"parameters": {
"functionCode": "// const query = $json[\"query\"] || {}\n// const filters = []\n// if (query.name) filters.push([\"name\", \"Like\", query.name])\n// if (query.country) filters.push([\"country_code\", \"=\", query.country])\n// const limit = query.limit ? parseInt(query.limit) : 25\n// const response_format = query.response_format || 'json'\n// return [{ json: { filters, limit, response_format } }]\n\nconst query = $json[\"query\"] || {};\n\n// Validate required 'name' parameter\nif (!query.name || query.name.trim() === \"\") {\n return [\n {\n json: {\n success: false,\n message: \"Missing required parameter: name\",\n },\n },\n ];\n}\n\nconst filters = [];\nfilters.push([\"name\", \"Like\", query.name]); // name is mandatory\n\nconst response_format = query.response_format || \"json\";\n\nreturn [\n {\n json: { filters, response_format },\n },\n];"
},
"typeVersion": 1
},
{
"id": "e727d97c-678b-41b8-8db4-d1615c73a116",
"name": "准备输出数据1",
"type": "n8n-nodes-base.function",
"position": [
0,
3152
],
"parameters": {
"functionCode": "if (items.length === 0 || Object.keys(items[0].json).length === 0) {\n return [{ json: { success: false, message: 'No matching company records found' } }]\n}\nconst data = items.map(item => ({ ...item.json, report_generated_on: new Date().toISOString() }))\nreturn data.map(d => ({ json: d }))"
},
"typeVersion": 1
},
{
"id": "9187426f-d4d0-4461-af73-3f31cdb0cc17",
"name": "检查是否需要Excel1",
"type": "n8n-nodes-base.if",
"position": [
288,
3152
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $('Prepare Dynamic Filter1').item.json.response_format }}",
"value2": "excel"
}
]
}
},
"typeVersion": 1
},
{
"id": "ed6030ad-11f0-43f6-aee5-147ee0c055de",
"name": "转换为Excel1",
"type": "n8n-nodes-base.convertToFile",
"position": [
896,
3104
],
"parameters": {
"options": {},
"operation": "xlsx"
},
"typeVersion": 1.1
},
{
"id": "0e6e1540-4c2e-45fe-a75a-6e511a95937b",
"name": "响应文件1",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1216,
3104
],
"parameters": {
"options": {},
"respondWith": "binary"
},
"typeVersion": 1.4
},
{
"id": "d64e68cf-c80c-4633-bc4f-614d572ca762",
"name": "响应JSON1",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1216,
3504
],
"parameters": {
"options": {},
"respondWith": "allIncomingItems"
},
"typeVersion": 1.4
},
{
"id": "d2f28f28-a541-42d1-aaf8-94ab14723a53",
"name": "概述说明1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1792,
2288
],
"parameters": {
"width": 900,
"height": 620,
"content": "## 工作原理"
},
"typeVersion": 1
},
{
"id": "ad743706-da44-436c-a330-96f289469989",
"name": "获取客户",
"type": "n8n-nodes-base.odoo",
"position": [
-320,
3152
],
"parameters": {
"options": {
"fieldsList": [
"display_name",
"name",
"email",
"phone",
"mobile",
"parent_id",
"country_code",
"country_id"
]
},
"resource": "custom",
"operation": "getAll",
"returnAll": true,
"filterRequest": {
"filter": [
{
"value": "={{ $json.filters[0][2] && $json.filters[0][2].toString().trim() !== '' ? $json.filters[0][2] : \"False\" }}",
"operator": "like",
"fieldName": "name"
}
]
},
"customResource": "res.partner"
},
"credentials": {
"odooApi": {
"id": "rhW7JbaWT0NTawBZ",
"name": "IMM Odoo 18"
}
},
"typeVersion": 1
},
{
"id": "5d55b9d2-a30b-4efd-8a22-e4d80851163a",
"name": "概述说明2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-880,
2928
],
"parameters": {
"color": 7,
"width": 452,
"height": 380,
"content": "## 请求和验证"
},
"typeVersion": 1
},
{
"id": "e8d5c637-2adc-4c45-ab56-81eabe9af5ee",
"name": "概述说明3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
2928
],
"parameters": {
"color": 7,
"width": 276,
"height": 380,
"content": "## 从Odoo搜索记录"
},
"typeVersion": 1
},
{
"id": "5b009e21-3259-430b-aaf1-044e5c364eb8",
"name": "概述说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-96,
2928
],
"parameters": {
"color": 7,
"width": 276,
"height": 380,
"content": "## 准备数据并管理响应json对象。"
},
"typeVersion": 1
},
{
"id": "af201ab6-7f0f-4806-bba1-7d9f718eeb75",
"name": "概述说明5",
"type": "n8n-nodes-base.stickyNote",
"position": [
208,
2928
],
"parameters": {
"color": 7,
"width": 276,
"height": 380,
"content": "## 检查response_format"
},
"typeVersion": 1
},
{
"id": "1b71d124-7d74-421c-882d-c67b6e6f9c08",
"name": "返回所有数据以创建二进制文件",
"type": "n8n-nodes-base.code",
"position": [
592,
3104
],
"parameters": {
"jsCode": "return $input.all()"
},
"typeVersion": 2
},
{
"id": "4dab4b62-287e-48ab-851d-8f8277d4eb10",
"name": "概述说明6",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
2928
],
"parameters": {
"color": 7,
"width": 276,
"height": 380,
"content": "## 为二进制文件准备数据。"
},
"typeVersion": 1
},
{
"id": "d7dccf04-2209-4638-a535-175b8207a70d",
"name": "概述说明7",
"type": "n8n-nodes-base.stickyNote",
"position": [
816,
2928
],
"parameters": {
"color": 7,
"width": 276,
"height": 380,
"content": "## 创建excel文件"
},
"typeVersion": 1
},
{
"id": "278e9a77-f740-4adb-8a9b-465cc48b56e2",
"name": "概述说明8",
"type": "n8n-nodes-base.stickyNote",
"position": [
1120,
2928
],
"parameters": {
"color": 7,
"width": 276,
"height": 380,
"content": "## 响应web-hook并提供excel文件。"
},
"typeVersion": 1
},
{
"id": "e86f38f1-12de-4da2-99e2-f5e4cf863b27",
"name": "概述说明9",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
3328
],
"parameters": {
"color": 7,
"width": 276,
"height": 380,
"content": "## 响应web-hook并提供json对象。"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Fetch Customer": {
"main": [
[
{
"node": "Prepare Output Data1",
"type": "main",
"index": 0
}
]
]
},
"Convert to Excel1": {
"main": [
[
{
"node": "Respond with File1",
"type": "main",
"index": 0
}
]
]
},
"Prepare Output Data1": {
"main": [
[
{
"node": "Check If Excel Required1",
"type": "main",
"index": 0
}
]
]
},
"Prepare Dynamic Filter1": {
"main": [
[
{
"node": "Fetch Customer",
"type": "main",
"index": 0
}
]
]
},
"Check If Excel Required1": {
"main": [
[
{
"node": "Return all data for create binary file",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond with JSON1",
"type": "main",
"index": 0
}
]
]
},
"Receive Company Request1": {
"main": [
[
{
"node": "Prepare Dynamic Filter1",
"type": "main",
"index": 0
}
]
]
},
"Return all data for create binary file": {
"main": [
[
{
"node": "Convert to Excel1",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客户关系管理
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
通过API端点导出Odoo公司数据,支持JSON/Excel输出选项
通过API端点导出Odoo公司数据,支持JSON/Excel输出选项
If
Code
Odoo
+5
18 节点V3 Code Studio
客户关系管理
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他
自动化订单确认,使用Abacate Pay:首购优惠券奖励,通过邮件和Slack
自动化订单确认,使用Abacate Pay:首购优惠券奖励,通过邮件和Slack
If
Set
Code
+6
13 节点Matheus Pedrosa
客户关系管理
从Webhook生成潜在客户
捕获并结构化Web表单潜在客户,适用于Odoo CRM(兼容v15-v18)
Code
Odoo
Webhook
+2
7 节点Evozard
客户关系管理
Bitrix24任务表单小部件应用程序工作流示例
Bitrix24任务表单小部件应用程序工作流 (带Webhook集成)
If
Set
Code
+8
21 节点Ferenc Erb
其他
工作流信息
难度等级
高级
节点数量18
分类1
节点类型8
作者
V3 Code Studio
@v3codestudio🚀 AI & Automation Expert | n8n Creator | Workflow Specialist | Automation Specialist | V3 Code Studio I build smart automation workflows with n8n to help businesses streamline operations, save time, and increase productivity. Passionate about no-code/low-code automation and AI-driven solutions that make processes efficient, scalable, and growth-oriented.
外部链接
在 n8n.io 查看 →
分享此工作流