Project

class moco_wrapper.models.Project(moco)

Class for handling projects.

archive(id: int)

Archive a project.

Parameters:id – Id of the project to archive
Returns:The archived project
assigned(active: bool = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Get list of all project currently assigned to the user.

Parameters:
  • active – Show only active or inacitve projects
  • sort_by – Sort by field
  • sort_order – asc or desc (default asc)
  • page – Page number (default 1)
Returns:

List of project objects

create(name: str, currency: str, leader_id: int, customer_id: int, finish_date: datetime.date = None, identifier: str = None, billing_address: str = None, billing_variant: moco_wrapper.models.project.ProjectBillingVariant = None, hourly_rate: float = None, budget: float = None, labels: list = None, custom_properties: dict = None, info: str = None)

Create a new project.

Parameters:
  • name – Name of the project
  • currency – Currency used by the project (e.g. EUR)
  • leader_id – User id of the project leader
  • customer_id – Company id of the customer
  • finish_date – Finish date
  • identifier – Project Identifier
  • billing_address – Billing adress the invoices go to
  • billing_variant – Billing variant used. For allowed values see ProjectBillingVariant.
  • hourly_rate – Hourly rate that will get billed
  • budget – Budget for the project
  • labels – Array of additional labels
  • custom_properties – Custom values used by the project
  • info – Additional information
Returns:

The created project object

Note

The parameter identifier is required if number ranges are manual.

get(id: int)

Get a single project.

Parameters:id – Id of the project
Returns:Project object
getlist(include_archived: bool = None, include_company: bool = None, leader_id: int = None, company_id: int = None, created_from: datetime.date = None, created_to: datetime.date = None, updated_from: datetime.date = None, updated_to: datetime.date = None, tags: list = None, identifier: str = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Get a list of projects.

Parameters:
  • include_archived – Include archived projects
  • include_company – Include the complete company object or just the company id
  • leader_id – User id of the project leader
  • company_id – Company id the projects are assigned to
  • created_from – Created start date
  • created_to – Created end date
  • updated_from – Updated start date
  • updated_to – Updated end date
  • tags – Array of tags
  • identifier – Project identifer
  • sort_by – Field to sort the results by
  • sort_order – asc or desc (default asc)
  • page – Page number (default 1)
Returns:

List of project objects

report(id: int)

Retrieve a project report.

All costs are in the accounts main currency, it might differ from the budget and billable items.

Parameters:id – Id of the project
Returns:Report with the most important project business indicators
unarchive(id: int)

Unarchive a project.

Parameters:id – Id of the project to unarchive
Returns:The unarchived project
update(id: int, name: str = None, leader_id: int = None, customer_id: int = None, finish_date: datetime.date = None, identifier: str = None, billing_address: str = None, billing_variant: moco_wrapper.models.project.ProjectBillingVariant = None, hourly_rate: float = None, budget: float = None, labels: list = None, custom_properties: dict = None, info: str = None)

Update an existing project.

Parameters:
  • id – Id of the project to update
  • name – Name of the project
  • leader_id – User id of the project leader
  • customer_id – Company id of the customer
  • finish_date – Finish date
  • identifier – Project Identifier
  • billing_address – Address the invoices go to
  • billing_variant – Billing variant used. For allowed values see ProjectBillingVariant.
  • hourly_rate – Hourly rate that will get billed
  • budget – Budget for the project
  • labels – Array of additional labels
  • custom_properties – Custom values used by the project
  • info – Additional information
Returns:

The updated project object

class moco_wrapper.models.project.ProjectBillingVariant

Enumeration for allowed values of the billing_variant argument of Project.create() and Project.update().

Example usage:

from moco_wrapper.models.project import ProjectBillingVariant
from moco_wrapper import Moco

m = Moco()
new_project = m.Project.create(
    ..
    billing_variant = ProjectBillingVariant.USER 
)
PROJECT = 'project'
TASK = 'task'
USER = 'user'