Deal Category¶
-
class
moco_wrapper.models.
DealCategory
(moco)¶ Model for handling the different deal_categories used by a pending deal.
A deal (see
moco_wrapper.models.Deal
) that is in the statePENDING
(seemoco_wrapper.models.deal.DealStatus
) must be assigned to deal category. A category has a name and a probability of success (in percent).Typicly a deal that is in
PENDING
starts at 1% and moves into the stateWON
if the probability reaches 100%.from moco_wrapper import Moco m = Moco() #create a category with 75% success probability new_category = m.DealCategory.create( "Second round of negotiation", 75 )
-
create
(name: str, probability: int)¶ Create a new deal category.
Parameters: - name (str) – Name of the deal category (must be unique)
- probability (int) – Deal category success probability (between 1 and 100)
Returns: The created deal category
-
delete
(category_id: int)¶ Delete a deal category.
Parameters: category_id (int) – Id of the deal category to delete Reuturns: Empty response on success
-
get
(category_id: int)¶ Retrieves a single deal category.
Parameters: category_id (int) – Id of the deal category to retrieve Returns: Single deal category
-
getlist
(sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieves a list of a deal categories.
Parameters: - sort_by (str) – Field to sort by
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of deal categories
-
update
(category_id: int, name: str = None, probability: int = None)¶ Updates an existing deal category.
Parameters: - category_id (int) – Id of the deal category to update
- name (str) – Name of the deal category (must be unique)
- probability (int) – Deal category success probability (between 1 and 100)
Returns: The updated deal category
-