ppm_role_activate
Activate a draft role assignment to synchronize security groups and apply the role to users.
Instructions
Activate a draft role assignment (syncs the security group).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignment_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/qod_ppm_mcp/server.py:327-331 (handler)Handler function for the ppm_role_activate tool. Calls the 'action_activate' method on 'ppm.role.assignment' via Odoo RPC and returns the updated state fields.
@mcp.tool() def ppm_role_activate(assignment_id: int) -> dict[str, Any]: """Activate a draft role assignment (syncs the security group).""" client().call_action("ppm.role.assignment", "action_activate", [assignment_id]) return _read_state("ppm.role.assignment", assignment_id, _ROLE_FIELDS) - src/qod_ppm_mcp/server.py:327-331 (registration)Registration via @mcp.tool() decorator on the FastMCP instance 'mcp'. The function is both the registration point and the handler.
@mcp.tool() def ppm_role_activate(assignment_id: int) -> dict[str, Any]: """Activate a draft role assignment (syncs the security group).""" client().call_action("ppm.role.assignment", "action_activate", [assignment_id]) return _read_state("ppm.role.assignment", assignment_id, _ROLE_FIELDS) - src/qod_ppm_mcp/server.py:30-34 (helper)Helper function _read_state used by ppm_role_activate to read back the role assignment record after activation.
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:324-324 (helper)Field list for role assignment read operations, used by ppm_role_activate.
_ROLE_FIELDS = ["name", "state", "role_id", "user_id", "project_id", "date_from", "date_to"] - src/qod_ppm_mcp/client.py:122-124 (helper)OdooClient.call_action helper that invokes the Odoo server-side method via execute_kw. Used by ppm_role_activate to call 'action_activate' on 'ppm.role.assignment'.
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])