ppm_risk_close
Close a risk by setting its date_closed to finalize risk management in Odoo PPM. Use this action to update the risk status and trigger state transitions.
Instructions
Close a risk; sets date_closed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| risk_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/qod_ppm_mcp/server.py:247-251 (handler)The handler function for the ppm_risk_close tool. Calls action_close on the ppm.risk model via the Odoo client and returns the updated risk state.
@mcp.tool() def ppm_risk_close(risk_id: int) -> dict[str, Any]: """Close a risk; sets date_closed.""" client().call_action("ppm.risk", "action_close", [risk_id]) return _read_state("ppm.risk", risk_id, _RISK_FIELDS) - src/qod_ppm_mcp/server.py:247-247 (registration)The @mcp.tool() decorator registers ppm_risk_close as a FastMCP tool.
@mcp.tool() - src/qod_ppm_mcp/server.py:206-216 (schema)Schema fields returned when reading the risk state after closing.
_RISK_FIELDS = [ "name", "state", "risk_type", "probability", "impact", "risk_score", "risk_level", "project_id", "owner_id", ] - src/qod_ppm_mcp/server.py:30-34 (helper)Helper function that reads and returns the current state of a record after the action is performed.
def _read_state(model: str, rec_id: int, fields: list[str]) -> dict[str, Any]: rows = client().read(model, [rec_id], fields) if not rows: raise ValueError(f"{model} id={rec_id} not found") return rows[0] - src/qod_ppm_mcp/server.py:23-27 (helper)Lazy-initialized singleton factory for the OdooClient used to communicate with the Odoo backend.
def client() -> OdooClient: global _client if _client is None: _client = OdooClient.from_env() return _client