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 – Deal id of the offer
  • project_id – project id of the offer
  • recipient_address – Address of the recipient (e.g. Test Custmer\nMain Street 5\nExample Town)
  • creation_date – Creation date
  • due_date – Date the offer is due
  • title – Title of the offer
  • tax – Tax (0.0-100.0)
  • currency – Currency code used (e.g. EUR, CHF)
  • items – List of offer items
  • change_address – change offer address propagation. For allowed values see OfferChangeAddress.
  • salutation – Salutation text
  • footer – Footer text
  • discount – Discount in percent
  • contact_id – Id of the contact for the offer

Note

Either deal_id or project_id must be specified (or both)

get(id: int)

Retrieve a single offer.

Parameters:id – 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 – State the offer is in. For allowed values see OfferStatus.
  • from_date – Start date
  • to_date – End date
  • identifier – Identifier string (e.g.: “A1903-003”)
  • sort_by – Field to sort the results by
  • sort_order – asc or desc (default asc)
  • page – Page number (default 1)
Returns:

List of offer objects

Note

Offers can be sorted by date, created_at and title.

pdf(id: int, letter_paper_id: int = None)

Retrieve the offer document for a single offer.

Parameters:
  • id – Id of the offer
  • letter_paper_id – Id of the letter paper (default white)
Returns:

The offers pdf document

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'
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'