Project Recurring Expense

class moco_wrapper.models.ProjectRecurringExpense(moco)

Class for handling recurring expenses of a project.

An example for this would be when a third part subscription (repeat cost) is bought for a specific customer project and then get billed to the project to regain the cost.

See also

moco_wrapper.models.ProjectExpense for one time expenses.

create(project_id: int, start_date: datetime.date, period: moco_wrapper.models.project_recurring_expense.ProjectRecurringExpensePeriod, title: str, quantity: float, unit: str, unit_price: float, unit_cost: float, finish_date: datetime.date = None, description: str = None, billable: bool = True, budget_relevant: bool = False, service_period_direction: moco_wrapper.models.project_recurring_expense.ProjectRecurringExpenseServicePeriodDirection = None, custom_properties: dict = None)

Create a new recurring expense for a project.

Parameters:
  • project_id (int) – Id of the project to create the expense for
  • start_date (datetime.date, str) – Starting date of the expense
  • period (ProjectRecurringExpensePeriod, str) – period of the expense
  • title (str) – Title of the expense
  • quantity (float) – Quantity (how much of unit was bought?)
  • unit (str) – Name of the unit (What was bought for the customer/project?)
  • unit_price (float) – Price of the unit that will be billed to the customer/project
  • unit_cost (float) – Cost that we had to pay
  • finish_date (datetime.date, str) – Finish date, (if None: unlimited) (default None)
  • description (str) – Description of the expense (default None)
  • billable (bool) – If this expense billable (default True)
  • budget_relevant (bool) – If this expense is budget relevant (default False)
  • service_period_direction (ProjectRecurringExpenseServicePeriodDirection, str) – Direction of the service period (default None)
  • custom_properties (dict) – Additional fields as dictionary (default None)
Returns:

The created recurring expense object

Return type:

moco_wrapper.util.response.ObjectResponse

delete(project_id: int, recurring_expense_id: int)

Deletes an existing recurring expense.

Parameters:
  • project_id (int) – Project id the expense belongs to
  • recurring_expense_id (int) – Id of the expense to delete
Returns:

Empty response on success

Return type:

moco_wrapper.util.response.EmptyResponse

static endpoints() → List[moco_wrapper.util.endpoint.endpoint.Endpoint]

Returns all endpoints associated with the model

Returns:List of Endpoint objects
Return type:moco_wrapper.util.endpoint.Endpoint
get(project_id: int, recurring_expense_id: int)

Retrieve a single recurring expense

Parameters:
  • project_id (int) – Id of the project the expense belongs to
  • recurring_expense_id (int) – iI of the recurring expense
Returns:

Single recurring expense object

Return type:

moco_wrapper.util.response.ObjectResponse

getlist(project_id: int, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Retrieve a list of recurring expenses for a project.

Parameters:
  • project_id (int) – Id of the project the expenses belong to
  • sort_by (str) – Field to sort results by (default None)
  • sort_order (str) – asc or desc (default "asc")
  • page (int) – Page number (default 1)
Returns:

List of recurring expenses

Return type:

moco_wrapper.util.response.PagedListResponse

update(project_id: int, recurring_expense_id: int, title: str = None, quantity: float = None, unit: str = None, unit_price: float = None, unit_cost: float = None, finish_date: datetime.date = None, description: str = None, billable: bool = None, budget_relevant: bool = None, service_period_direction: moco_wrapper.models.project_recurring_expense.ProjectRecurringExpenseServicePeriodDirection = None, custom_properties: dict = None)

Update an existing recurring expense.

Parameters:
  • project_id (int) – Id of the project
  • recurring_expense_id (int) – Id of the recurring expense to update
  • title (str) – Title of the expense (default None)
  • quantity (int) – Quantity (how much of unit was bought?) (default None)
  • unit (str) – Name of the unit (What was bought for the customer/project?) (default None)
  • unit_price (float) – Price of the unit that will be billed to the customer/project (default None)
  • unit_cost (float) – Cost that we had to pay (default None)
  • finish_date (datetime.date, str) – Finish date, (if None: unlimited) (default None)
  • description (str) – Description of the expense (default None)
  • billable (bool) – If this expense billable (default None)
  • budget_relevant – If this expense is budget relevant (default None)
  • service_period_direction (ProjectRecurringExpenseServicePeriodDirection, str) – Direction of the service period (default None)
  • custom_properties (dict) – Additional fields as dictionary (default None)
Returns:

The updated recurring expense object

Return type:

moco_wrapper.util.response.ObjectResponse

class moco_wrapper.models.project_recurring_expense.ProjectRecurringExpensePeriod

Enumeration for allowed values of period argument of ProjectRecurringExpense.create().

Example usage:

from moco_wrapper.models.project_recurring_expense import ProjectRecurringExpensePeriod
from moco_wrapper import Moco

m = Moco()
recur_expense = m.ProjectRecurringExpense.create(
    ..
    period = ProjectRecurringExpensePeriod.WEEKLY
)
ANNUAL = 'annual'
BIANNUAL = 'biannual'
BIWEEKLY = 'biweekly'
MONTHLY = 'monthly'
QUARTERLY = 'quarterly'
WEEKLY = 'weekly'
class moco_wrapper.models.project_recurring_expense.ProjectRecurringExpenseServicePeriodDirection

Enumeration for allowed values service_period_direction of ProjectRecurringExpense.create().

Example usage:

from moco_wrapper.models.project_recurring_expense import ProjectRecurringExpenseServicePeriodDirection
from moco_wrapper import Moco

m = Moco()
recur_expense = m.ProjectRecurringExpense.create(
    ..
    service_period_direction = ProjectRecurringExpenseServicePeriodDirection.BACKWARD
)
BACKWARD = 'backward'
FORWARD = 'forward'
NONE = 'none'