ppm_export_risks
Export a filtered risk register to XLSX. Optionally specify project, portfolio, risk level, or include closed risks.
Instructions
Export the risk register to XLSX.
risk_level is one of 'low', 'medium', 'high', 'critical' — or omit for all.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | ||
| portfolio_id | No | ||
| risk_level | No | ||
| include_closed | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/qod_ppm_mcp/server.py:400-418 (handler)The actual handler function for the 'ppm_export_risks' tool. Decorated with @mcp.tool(), it accepts optional project_id, portfolio_id, risk_level, and include_closed parameters, builds a vals dict, and delegates to _run_export_wizard('ppm.risk.export.wizard', vals).
@mcp.tool() def ppm_export_risks( project_id: int | None = None, portfolio_id: int | None = None, risk_level: str | None = None, include_closed: bool = False, ) -> dict[str, Any]: """Export the risk register to XLSX. `risk_level` is one of 'low', 'medium', 'high', 'critical' — or omit for all. """ vals: dict[str, Any] = {"include_closed": include_closed} if project_id is not None: vals["project_id"] = project_id if portfolio_id is not None: vals["portfolio_id"] = portfolio_id if risk_level: vals["risk_level"] = risk_level return _run_export_wizard("ppm.risk.export.wizard", vals) - src/qod_ppm_mcp/server.py:362-369 (helper)The helper function _run_export_wizard that ppm_export_risks calls. It creates a wizard record via execute_kw and then calls the action_export button method on it, returning a dict with the wizard model name and the action result.
def _run_export_wizard( model: str, values: dict[str, Any], ) -> dict[str, Any]: wizard_id = client().execute_kw(model, "create", [values]) action = client().call_action(model, "action_export", [wizard_id]) # action is `ir.actions.act_url` with /web/content/{attachment_id}?download=true return {"wizard": model, "action": action} - src/qod_ppm_mcp/server.py:400-400 (registration)The tool registration: the @mcp.tool() decorator on line 400 registers ppm_export_risks as an MCP tool on the FastMCP instance named 'qod-ppm'.
@mcp.tool() - src/qod_ppm_mcp/client.py:80-128 (helper)The OdooClient helper methods (execute_kw and call_action) used by _run_export_wizard to create the wizard record and invoke the export action.
def execute_kw( self, model: str, method: str, args: list[Any] | None = None, kwargs: dict[str, Any] | None = None, ) -> Any: return self._call( "object", "execute_kw", [self.db, self.uid, self.secret, model, method, args or [], kwargs or {}], ) def search_read( self, model: str, domain: list[Any] | None = None, fields: list[str] | None = None, limit: int | None = None, offset: int | None = None, order: str | None = None, ) -> list[dict[str, Any]]: kwargs: dict[str, Any] = {} if fields is not None: kwargs["fields"] = fields if limit is not None: kwargs["limit"] = limit if offset is not None: kwargs["offset"] = offset if order is not None: kwargs["order"] = order return self.execute_kw(model, "search_read", [domain or []], kwargs) def read( self, model: str, ids: list[int], fields: list[str] | None = None, ) -> list[dict[str, Any]]: kwargs = {"fields": fields} if fields else {} return self.execute_kw(model, "read", [ids], kwargs) def call_action(self, model: str, method: str, ids: list[int]) -> Any: """Invoke an `action_*` button method on the given record ids.""" return self.execute_kw(model, method, [ids]) def close(self) -> None: self._http.close()