Offer

class moco_wrapper.models.Offer(moco)

Class for handling offers.

create(recipient_address: str, creation_date: datetime.date, due_date: datetime.date, title: str, tax: float, currency: str, items: list, company_id: int = None, deal_id: int = None, project_id: int = None, change_address: moco_wrapper.models.offer.OfferChangeAddress = <OfferChangeAddress.OFFER: 'offer'>, salutation: str = None, footer: str = None, discount: float = None, contact_id: int = None, tags: list = None, custom_properties: dict = None)

Create a new offer.

Parameters:
  • recipient_address (str) – Address of the recipient
  • 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
  • company_id (int) – Id of the associated company (default None)
  • deal_id (int) – Deal id of the offer (default None)
  • project_id (int) – project id of the offer (default None)
  • change_address (OfferChangeAddress, str) – change offer address propagation (default OfferChangeAddress.OFFER)
  • salutation (str) – Salutation text (default None)
  • footer (str) – Footer text (default None)
  • discount (float) – Discount in percent (default None)
  • contact_id (int) – Id of the contact for the offer (default None)
  • tags (list) – List of tags (default None)
  • custom_properties (dict) – Dict of custom properties (default None)
Returns:

The created offer

Return type:

moco_wrapper.util.response.ObjectResponse

Note

Either deal_id or project_id must be specified (or both)

Note

If you specify the parameter project_id the parameter company_id will be disregard

static endpoints() → List[moco_wrapper.util.endpoint.endpoint.Endpoint]

Returns all endpoints associated with the model

Returns:List of Endpoint objects
Return type:moco_wrapper.util.endpoint.Endpoint
get(offer_id: int)

Retrieve a single offer.

Parameters:offer_id (int) – Id of the offer
Returns:Single offer object
Return type:moco_wrapper.util.response.ObjectResponse
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 (default None)
  • from_date (datetime.date, str) – Start date (default None)
  • to_date (datetime.date, str) – End date (default None)
  • identifier (str) – Identifier string (e.g.: “A1903-003”) (default None)
  • sort_by (str) – Field to sort the results by (default None)
  • sort_order (str) – asc or desc (default "asc")
  • page (int) – Page number (default 1)
Returns:

List of offer objects

Return type:

moco_wrapper.util.response.PagedListResponse

pdf(offer_id: int)

Retrieve the offer document for a single offer.

Parameters:offer_id (int) – Id of the offer
Returns:The offers pdf document
Return type:moco_wrapper.util.response.FileResponse
update_status(offer_id: int, status: moco_wrapper.models.offer.OfferStatus)

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

Return type:

moco_wrapper.util.response.EmptyResponse

class moco_wrapper.models.offer.OfferStatus

Enumeration for allowed values of the status argument of Offer.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 of Offer.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'