Offer¶
-
class
moco_wrapper.models.
Offer
(moco)¶ Class for handling offers.
-
create
(deal_id: int, project_id: int, recipient_address: str, creation_date: datetime.date, due_date: datetime.date, title: str, tax: float, currency: str, items: list, change_address: moco_wrapper.models.offer.OfferChangeAddress = <OfferChangeAddress.OFFER: 'offer'>, salutation: str = None, footer: str = None, discount: float = None, contact_id: int = None)¶ Create a new offer.
Parameters: - deal_id (int) – Deal id of the offer
- project_id (int) – project id of the offer
- recipient_address (str) – Address of the recipient (e.g. Test Custmer\nMain Street 5\nExample Town)
- creation_date (datetime.date, str) – Creation date
- due_date (datetime.date, str) – Date the offer is due
- title (str) – Title of the offer
- tax (float) – Tax (0.0-100.0)
- currency (str) – Currency code used (e.g. EUR, CHF)
- items (list) – List of offer items
- change_address (
OfferChangeAddress
, str) – change offer address propagation - salutation (str) – Salutation text
- footer (str) – Footer text
- discount (float) – Discount in percent
- contact_id (int) – Id of the contact for the offer
Returns: The created offer
Note
Either
deal_id
orproject_id
must be specified (or both)
-
get
(offer_id: int)¶ Retrieve a single offer.
Parameters: offer_id (int) – Id of the offer Returns: Single offer object
-
getlist
(status: moco_wrapper.models.offer.OfferStatus = None, from_date: datetime.date = None, to_date: datetime.date = None, identifier: str = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieve a list of offers.
Parameters: - status (
OfferStatus
, str) – State the offer is in - from_date (datetime.date, str) – Start date
- to_date (datetime.date, str) – End date
- identifier (str) – Identifier string (e.g.: “A1903-003”)
- sort_by (str) – Field to sort the results by
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of offer objects
Note
Offers can be sorted by
date
,created_at
andtitle
.- status (
-
pdf
(offer_id: int, letter_paper_id: int = None)¶ Retrieve the offer document for a single offer.
Parameters: - offer_id (int) – Id of the offer
- letter_paper_id (int) – Id of the letter paper (default white)
Returns: The offers pdf document
-
update_status
(offer_id, status)¶ Updates the state of an offer
Parameters: - offer_id (int) – Id of the offer
- status (
OfferStatus
, str) – The new state for the offer
Returns: Empty response on success
-
-
class
moco_wrapper.models.offer.
OfferStatus
¶ Enumeration for allowed values of the
status
argument ofOffer.getlist()
.Example usage:
from moco_wrapper.models.offer import OfferStatus from moco_wrapper import Moco m = Moco() sent_offers = m.Offer.getlist( .. status = OfferStatus.SENT )
-
ACCEPTED
= 'accepted'¶
-
ARCHIVED
= 'archived'¶
-
BILLED
= 'billed'¶
-
CREATED
= 'created'¶
-
PARTIALLY_BILLED
= 'partially_billed'¶
-
SENT
= 'sent'¶
-
-
class
moco_wrapper.models.offer.
OfferChangeAddress
¶ Enumeration for allowed values of the
change_address
argument ofOffer.create()
.Example usage:
from moco_wrapper.models.offer import OfferChangeAddress from moco_wrapper import Moco m = Moco() new_offer = m.Offer.create( .. change_address = OfferChangeAddress.CUSTOMER )
-
CUSTOMER
= 'customer'¶
-
OFFER
= 'offer'¶
-