Project Contract¶
-
class
moco_wrapper.models.
ProjectContract
(moco)¶ Class for handling project contracts.
When a user gets assigned to a project, that is called a project contract. This can be done with this model.
-
create
(project_id: int, user_id: int, billable: bool = None, active: bool = None, budget: float = None, hourly_rate: float = None)¶ Assign a user to a project.
Parameters: - project_id (int) – Id of the project
- user_id (int) – User id of the person to assign
- billable (bool) – If the contract is billable
- active (bool) – If the contract is active
- budget (float) – Contract budget
- hourly_rate (float) – Contract hourly rate
Returns: Created contract object
-
delete
(project_id: int, contract_id: int)¶ Delete a project contract.
Deleting a staff assignment is only possible as long as there no hours tracked from the assinged person for the project.
Parameters: - project_id (int) – Id of the project
- contract_id (int) – Id of the contract to delete
Returns: Empty response on success
-
get
(project_id: int, contract_id: int)¶ Retrieve a project contract.
Parameters: - project_id (int) – Id of the project
- contract_id (int) – Id of the contract
Returns: The contract object
-
getlist
(project_id: int, sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieve all active contracts for a project.
Parameters: - project_id (int) – Id of the project
- sort_by (str) – Sort by field
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of contract objects
-
update
(project_id: int, contract_id: int, billable: bool = None, active: bool = None, budget: float = None, hourly_rate: float = None)¶ Update an existing project contract.
Parameters: - project_id (int) – Id of the project to update the contract for
- contract_id – Id of the contract to update
- billable (bool) – If the contract is billable
- active (bool) – If the contract is active
- budget (float) – Contract budget
- hourly_rate (float) – Contract hourly rate
Returns: The updated project contract
-