Project Expense Generator¶
-
class
moco_wrapper.util.generator.
ProjectExpenseGenerator
¶ -
generate
(expense_date: datetime.date, title: str, quantity: float, unit: str, unit_price: float, unit_cost: float, description: str = None, billable: bool = True, budget_relevant: bool = False) → dict¶ Create an item that can be used for creating bulk project expenses.
Parameters: - project_id (int) – Id of the project to create the expense for
- expense_date (datetime.date, str) – Date of the expense
- title (str) – Exense title
- 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
- description (str) – Descripion of the expens
- billable (bool) – If this expense billable (default True)
- budget_relevant (bool) – If this expense is budget relevant (default False)
Returns: The created expense object
Example usage:
from moco_wrapper.util.generator import ProjectExpenseGenerator from moco_wrapper import Moco from datetime import date m = Moco() gen = ProjectExpenseGenerator() items = [ gen.generate( '2019-10-10', "the title", 5, "the unit", 20, 10 ), gen.generate( '2019-10-10', "different title", 5, "another unit", 20, 10, billable=False, description="the desc", budget_relevant=True ), gen.generate( date(2019, 10, 10), "another title", 2, "the unit", 20, 10 ), ] project_id = 2 created_expenses = m.ProjectExpense.create_bulk(project_id,items)
-