ppm_risk_mark_occurred
Mark a risk as occurred to update its status in the project risk register, confirming the risk event has happened.
Instructions
Mark a risk as occurred.
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:240-244 (handler)The MCP tool handler function. Takes a risk_id, calls the Odoo action 'action_mark_occurred' on the ppm.risk model, then reads and returns the updated risk state fields.
@mcp.tool() def ppm_risk_mark_occurred(risk_id: int) -> dict[str, Any]: """Mark a risk as occurred.""" client().call_action("ppm.risk", "action_mark_occurred", [risk_id]) return _read_state("ppm.risk", risk_id, _RISK_FIELDS) - src/qod_ppm_mcp/server.py:240-241 (registration)Registration as an MCP tool via the @mcp.tool() decorator on line 240, making it available in the FastMCP server named 'qod-ppm'.
@mcp.tool() def ppm_risk_mark_occurred(risk_id: int) -> dict[str, Any]: - src/qod_ppm_mcp/server.py:206-216 (schema)Schema: list of fields read back from the risk record after the action, used by the handler to return the updated state.
_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 specified fields of a record; used by the handler to return the updated risk after marking occurred.
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/client.py:122-124 (helper)The OdooClient.call_action method used by the handler to invoke 'action_mark_occurred' on the ppm.risk model.
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])