[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-674b04d2-1840-491e-ab33-0639d58ba990":3,"$f5lhc3rHTznd3cYIqUy4DBEHFNkulZPjue8uBDVhkS-U":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"674b04d2-1840-491e-ab33-0639d58ba990","odoo-woocommerce-bridge","同步Odoo与WooCommerce：通过WooCommerce REST API和Odoo外部API同步产品、库存、订单和客户。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: odoo-woocommerce-bridge\ndescription: \"Sync Odoo with WooCommerce: products, inventory, orders, and customers via WooCommerce REST API and Odoo external API.\"\nrisk: unknown\nsource: community\n---\n\n# Odoo ↔ WooCommerce Bridge\n\n## Overview\n\nThis 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.\n\n## When to Use This Skill\n\n- Running a WooCommerce store with Odoo for inventory and fulfillment.\n- Automatically pulling WooCommerce orders into Odoo as sale orders.\n- Keeping WooCommerce product stock in sync with Odoo's warehouse.\n- Mapping WooCommerce order statuses to Odoo delivery states.\n\n## How It Works\n\n1. **Activate**: Mention `@odoo-woocommerce-bridge` and describe your sync requirements.\n2. **Design**: Get the field mapping table between WooCommerce and Odoo objects.\n3. **Build**: Receive Python integration scripts using the WooCommerce REST API.\n\n## Field Mapping: WooCommerce → Odoo\n\n| WooCommerce | Odoo |\n|---|---|\n| `products` | `product.template` + `product.product` |\n| `orders` | `sale.order` + `sale.order.line` |\n| `customers` | `res.partner` |\n| `stock_quantity` | `stock.quant` |\n| `sku` | `product.product.default_code` |\n| `order status: processing` | Sale Order: `sale` (confirmed) |\n| `order status: completed` | Delivery: `done` |\n\n## Examples\n\n### Example 1: Pull WooCommerce Orders into Odoo (Python)\n\n```python\nfrom woocommerce import API\nimport xmlrpc.client\nimport os\n\n# WooCommerce client\nwcapi = API(\n    url=os.getenv(\"WC_URL\", \"https:\u002F\u002Fmystore.com\"),\n    consumer_key=os.getenv(\"WC_KEY\"),\n    consumer_secret=os.getenv(\"WC_SECRET\"),\n    version=\"wc\u002Fv3\"\n)\n\n# Odoo client\nodoo_url = os.getenv(\"ODOO_URL\", \"https:\u002F\u002Fmyodoo.example.com\")\ndb = os.getenv(\"ODOO_DB\", \"my_db\")\nuid = int(os.getenv(\"ODOO_UID\", \"2\"))\npwd = os.getenv(\"ODOO_PASSWORD\")\nmodels = xmlrpc.client.ServerProxy(f\"{odoo_url}\u002Fxmlrpc\u002F2\u002Fobject\")\n\n\ndef sync_orders():\n    # Get unprocessed WooCommerce orders\n    orders = wcapi.get(\"orders\", params={\"status\": \"processing\", \"per_page\": 50}).json()\n\n    for wc_order in orders:\n        # Find or create Odoo partner\n        email = wc_order['billing']['email']\n        partner = models.execute_kw(db, uid, pwd, 'res.partner', 'search',\n            [[['email', '=', email]]])\n        if not partner:\n            partner_id = models.execute_kw(db, uid, pwd, 'res.partner', 'create', [{\n                'name': f\"{wc_order['billing']['first_name']} {wc_order['billing']['last_name']}\",\n                'email': email,\n                'phone': wc_order['billing']['phone'],\n                'street': wc_order['billing']['address_1'],\n                'city': wc_order['billing']['city'],\n            }])\n        else:\n            partner_id = partner[0]\n\n        # Create Sale Order in Odoo\n        order_lines = []\n        for item in wc_order['line_items']:\n            product = models.execute_kw(db, uid, pwd, 'product.product', 'search',\n                [[['default_code', '=', item['sku']]]])\n            if product:\n                order_lines.append((0, 0, {\n                    'product_id': product[0],\n                    'product_uom_qty': item['quantity'],\n                    'price_unit': float(item['price']),\n                }))\n\n        models.execute_kw(db, uid, pwd, 'sale.order', 'create', [{\n            'partner_id': partner_id,\n            'client_order_ref': f\"WC-{wc_order['number']}\",\n            'order_line': order_lines,\n        }])\n\n        # Mark WooCommerce order as on-hold (processed by Odoo)\n        wcapi.put(f\"orders\u002F{wc_order['id']}\", {\"status\": \"on-hold\"})\n```\n\n### Example 2: Push Odoo Stock to WooCommerce\n\n```python\ndef sync_inventory_to_woocommerce():\n    # Get all products with a SKU from Odoo\n    products = models.execute_kw(db, uid, pwd, 'product.product', 'search_read',\n        [[['default_code', '!=', False], ['type', '=', 'product']]],\n        {'fields': ['default_code', 'qty_available']}\n    )\n\n    for product in products:\n        sku = product['default_code']\n        qty = int(product['qty_available'])\n\n        # Update WooCommerce by SKU\n        wc_products = wcapi.get(\"products\", params={\"sku\": sku}).json()\n        if wc_products:\n            wcapi.put(f\"products\u002F{wc_products[0]['id']}\", {\n                \"stock_quantity\": qty,\n                \"manage_stock\": True,\n            })\n```\n\n## Best Practices\n\n- ✅ **Do:** Use **SKU** as the unique identifier linking WooCommerce products to Odoo products.\n- ✅ **Do:** Run inventory sync on a **schedule** (every 15-30 min) rather than real-time to avoid rate limits.\n- ✅ **Do:** Log all API calls and errors to a database table for debugging.\n- ❌ **Don't:** Process the same WooCommerce order twice — flag it as processed immediately after import.\n- ❌ **Don't:** Sync draft or cancelled WooCommerce orders to Odoo — filter by `status = processing` or `completed`.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,127,1309,"2026-05-16 13:32:42",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"451d1c2c-2563-46a9-b975-03bc542f51f7","1.0.0","odoo-woocommerce-bridge.zip",2298,"uploads\u002Fskills\u002F674b04d2-1840-491e-ab33-0639d58ba990\u002Fodoo-woocommerce-bridge.zip","996abd8f66b179a91be61ad0cc2218545841cf68999b38497e456838ad2420c7","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":5356}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]