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 (str) – Name of the deal
- currency (str) – Currency used (e.g. EUR, CHF)
- money (float) – How much money can be generated from this deal (e.g. 205.0)
- reminder_date (datetime.date, str) – Reminder date
- user_id (int) – Id of the user the is responsible for this lead
- deal_category_id (int) – Deal category id
- company_id (int) – Company id
- info (str) – Additional information
- status (
DealStatus
, str) – Current state of the deal
Returns: The created deal object
-
get
(deal_id: int)¶ Retrieve a single deal.
Parameters: deal_id (int) – 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 (
DealStatus
, str) – State of deal - tags (list) – Array of tags
- sort_by (str) – Field to order results by
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of deal objects
- status (
-
update
(deal_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: - deal_id (int) – Id of the deal
- name (str) – Name of the deal
- currency (str) – Currency used (e.g. EUR, CHF)
- money (float) – How much money can be generated from this deal (e.g. 205.0)
- reminder_date (datetime.date, str) – Reminder date
- user_id (int) – Id of the user that is responsible for this deal
- deal_category_id (int) – Deal category id
- company_id (int) – Company id
- info (str) – Additional information
- status (
DealStatus
, str) – Current state of the deal
Returns: The updated deal object
-
-
class
moco_wrapper.models.deal.
DealStatus
¶ Enumeration for the allowed values that can be supplied for the
status
argument ofDeal.create()
,Deal.update()
andDeal.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'¶
-