Deal

class moco_wrapper.models.Deal(moco)

Class for handling deals/leads

create(name: str, currency: str, money: float, reminder_date: datetime.date, user_id: int, deal_category_id: int, company_id: int = None, info: str = None, status: str = 'pending')

Create a new deal.

Parameters:
  • name – Name of the deal
  • currency – Currency used (e.g. EUR, CHF)
  • money – How much money can be generated from this deal (e.g. 205.0)
  • reminder_date – Reminder date
  • user_id – Id of the user the is responsible for this lead
  • deal_category_id – Deal category id (see moco_wrapper.models.DealCategory)
  • company_id – Company id
  • info – Additional information
  • status – Current state of the deal. For allowed values see DealStatus.
Returns:

The created deal object

get(id: int)

Retrieve a single deal.

Parameters:id – Id of the deal
Returns:Single deal object
getlist(status: str = None, tags: list = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Retrieve a list of deal objects

Parameters:
  • status – State of deal. For allowed values see DealStatus.
  • tags – Array of tags
  • sort_by – Field to order results by
  • sort_order – asc or desc (default asc)
  • page – Page number (default 1)
Returns:

List of deal objects

update(id: int, name: str = None, currency: str = None, money: float = None, reminder_date: datetime.date = None, user_id: int = None, deal_category_id: int = None, company_id: int = None, info: str = None, status: moco_wrapper.models.deal.DealStatus = None)

Update an existing deal.

Parameters:
  • id – Id of the deal
  • name – Name of the deal
  • currency – Currency used (e.g. EUR, CHF)
  • money – How much money can be generated from this deal (e.g. 205.0)
  • reminder_date – Reminder date
  • user_id – Id of the user that is responsible for this deal
  • deal_category_id – Deal category id (see moco_wrapper.models.DealCategory)
  • company_id – Company id
  • info – Additional information
  • status – Current state of the deal. For allowed values see DealStatus.
Returns:

The updated deal object

class moco_wrapper.models.deal.DealStatus

Enumeration for the allowed values that can be supplied for the status argument of Deal.create(), Deal.update() and Deal.getlist().

from moco_wrapper.models.deal import DealStatus
from moco_wrapper import Moco

m = Moco()

deal_create = m.Deal.create(
    ..
    status = DealStatus.WON
)
DROPPED = 'dropped'
LOST = 'lost'
PENDING = 'pending'
POTENTIAL = 'potential'
WON = 'won'