跳到正文
Skillpedia
API 与服务器(后端)48k · #5355

odoo-woocommerce-bridge

它能做什么

这个工具可以把你的网店(WooCommerce)和你的管理系统(Odoo)连接起来,在两个系统之间同步商品、库存、订单和客户等信息。

适用场景

  • ✓当你用 Odoo 管理库存,并希望库存自动更新到你的 WooCommerce 店铺时。
  • ✓当 WooCommerce 店铺里的订单能自动出现在 Odoo 中时。
  • ✓当你想确保 Odoo 中的商品库存数量与 WooCommerce 店铺上显示的一致时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-woocommerce-bridge/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/odoo-woocommerce-bridge/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“帮我连接 Odoo 和 WooCommerce 店铺,同步商品和订单。”

每周 5 个新技能,1 分钟读完。

工作原理

你说明想要连接哪些数据(比如商品和订单)。工具会创建一份“映射表”,让两个系统能够互相理解对方的数据,并生成让这个连接正常运行的代码。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Odoo ↔ WooCommerce Bridge

Overview

This skill guides you through building a reliable sync bridge between Odoo (the back-office ERP) and WooCommerce (the WordPress online store). It covers product catalog sync, real-time inventory updates, order import, and customer record management.

When to Use This Skill

  • Running a WooCommerce store with Odoo for inventory and fulfillment.
  • Automatically pulling WooCommerce orders into Odoo as sale orders.
  • Keeping WooCommerce product stock in sync with Odoo's warehouse.
  • Mapping WooCommerce order statuses to Odoo delivery states.

How It Works

  1. Activate: Mention @odoo-woocommerce-bridge and describe your sync requirements.
  2. Design: Get the field mapping table between WooCommerce and Odoo objects.
  3. Build: Receive Python integration scripts using the WooCommerce REST API.

Field Mapping: WooCommerce → Odoo

WooCommerce Odoo
products product.template + product.product
orders sale.order + sale.order.line
customers res.partner
stock_quantity stock.quant
sku product.product.default_code
order status: processing Sale Order: sale (confirmed)
order status: completed Delivery: done

Examples

Example 1: Pull WooCommerce Orders into Odoo (Python)

from woocommerce import API
import xmlrpc.client
import os

# WooCommerce client
wcapi = API(
    url=os.getenv("WC_URL", "https://mystore.com"),
    consumer_key=os.getenv("WC_KEY"),
    consumer_secret=os.getenv("WC_SECRET"),
    version="wc/v3"
)

# Odoo client
odoo_url = os.getenv("ODOO_URL", "https://myodoo.example.com")
db = os.getenv("ODOO_DB", "my_db")
uid = int(os.getenv("ODOO_UID", "2"))
pwd = os.getenv("ODOO_PASSWORD")
models = xmlrpc.client.ServerProxy(f"{odoo_url}/xmlrpc/2/object")


def sync_orders():
    # Get unprocessed WooCommerce orders
    orders = wcapi.get("orders", params={"status": "processing", "per_page": 50}).json()

    for wc_order in orders:
        # Find or create Odoo partner
        email = wc_order['billing']['email']
        partner = models.execute_kw(db, uid, pwd, 'res.partner', 'search',
            [[['email', '=', email]]])
        if not partner:
            partner_id = models.execute_kw(db, uid, pwd, 'res.partner', 'create', [{
                'name': f"{wc_order['billing']['first_name']} {wc_order['billing']['last_name']}",
                'email': email,
                'phone': wc_order['billing']['phone'],
                'street': wc_order['billing']['address_1'],
                'city': wc_order['billing']['city'],
            }])
        else:
            partner_id = partner[0]

        # Create Sale Order in Odoo
        order_lines = []
        for item in wc_order['line_items']:
            product = models.execute_kw(db, uid, pwd, 'product.product', 'search',
                [[['default_code', '=', item['sku']]]])
            if product:
                order_lines.append((0, 0, {
                    'product_id': product[0],
                    'product_uom_qty': item['quantity'],
                    'price_unit': float(item['price']),
                }))

        models.execute_kw(db, uid, pwd, 'sale.order', 'create', [{
            'partner_id': partner_id,
            'client_order_ref': f"WC-{wc_order['number']}",
            'order_line': order_lines,
        }])

        # Mark WooCommerce order as on-hold (processed by Odoo)
        wcapi.put(f"orders/{wc_order['id']}", {"status": "on-hold"})

Example 2: Push Odoo Stock to WooCommerce

def sync_inventory_to_woocommerce():
    # Get all products with a SKU from Odoo
    products = models.execute_kw(db, uid, pwd, 'product.product', 'search_read',
        [[['default_code', '!=', False], ['type', '=', 'product']]],
        {'fields': ['default_code', 'qty_available']}
    )

    for product in products:
        sku = product['default_code']
        qty = int(product['qty_available'])

        # Update WooCommerce by SKU
        wc_products = wcapi.get("products", params={"sku": sku}).json()
        if wc_products:
            wcapi.put(f"products/{wc_products[0]['id']}", {
                "stock_quantity": qty,
                "manage_stock": True,
            })

Best Practices

  • ✅ Do: Use SKU as the unique identifier linking WooCommerce products to Odoo products.

…

常见问题

什么是 SKU?为什么它很重要?

SKU 是每个商品的唯一编码。在 Odoo 和 WooCommerce 中使用相同的 SKU,是确保商品被正确识别并在两个系统之间准确同步的最佳方式。

库存应该多久同步一次?

建议每 15-30 分钟同步一次库存。同步过于频繁可能会让系统超负荷。

能同步 WooCommerce 上的所有订单吗?

不建议这样做。最好只同步状态为“处理中”或“已完成”的订单,以避免出现问题。

详情

作者的原始描述

Sync Odoo with WooCommerce: products, inventory, orders, and customers via WooCommerce REST API and Odoo external API.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5355
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能