mirror of
https://github.com/latinogino/dolibarr-mcp.git
synced 2026-04-30 21:35:36 +02:00
Fix create_invoice missing product_id and add product_type support
This commit is contained in:
@@ -405,6 +405,15 @@ class DolibarrClient:
|
||||
if "customer_id" in payload and "socid" not in payload:
|
||||
payload["socid"] = payload.pop("customer_id")
|
||||
|
||||
# Fix: Map product_id to fk_product in lines
|
||||
if "lines" in payload and isinstance(payload["lines"], list):
|
||||
for line in payload["lines"]:
|
||||
if "product_id" in line:
|
||||
line["fk_product"] = line.pop("product_id")
|
||||
# Ensure product_type is passed if present (0=Product, 1=Service)
|
||||
if "product_type" in line:
|
||||
line["product_type"] = line["product_type"]
|
||||
|
||||
result = await self.request("POST", "invoices", data=payload)
|
||||
return self._extract_identifier(result)
|
||||
|
||||
|
||||
@@ -364,7 +364,9 @@ async def handle_list_tools():
|
||||
"subprice": {"type": "number", "description": "Unit price"},
|
||||
"total_ht": {"type": "number", "description": "Total excluding tax"},
|
||||
"total_ttc": {"type": "number", "description": "Total including tax"},
|
||||
"vat": {"type": "number", "description": "VAT rate"}
|
||||
"vat": {"type": "number", "description": "VAT rate"},
|
||||
"product_id": {"type": "integer", "description": "Product ID to link (optional)"},
|
||||
"product_type": {"type": "integer", "description": "Type of line (0=Product, 1=Service)"}
|
||||
},
|
||||
"required": ["desc", "qty", "subprice"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user