Invoice¶
-
class
moco_wrapper.models.
Invoice
(moco)¶ Models for handling invoices.
-
create
(customer_id: int, recipient_address: str, created_date: datetime.date, due_date: datetime.date, service_period_from: datetime.date, service_period_to: datetime.date, title: str, tax: float, currency: str, items: list, status: moco_wrapper.models.invoice.InvoiceStatus = <InvoiceStatus.CREATED: 'created'>, change_address: moco_wrapper.models.invoice.InvoiceChangeAddress = <InvoiceChangeAddress.INVOICE: 'invoice'>, salutation: str = None, footer: str = None, discount: float = None, cash_discount: float = None, cash_discount_days: int = None, project_id: int = None)¶ Creates a new invoice.
Parameters: - customer_id – Id of the customer/company
- recipient_address – Entry text for the customer (e.g. “My Customer\nMainStreet 5\nExample Town”)
- created_date – Creation date of the invoice
- due_date – Date the invoice is due
- service_period_from – Service period start date
- service_period_to – Service period end date
- title – Title of the invoice
- tax – Tax percent (between 0.0 and 100.0)
- currency – Currency code (e.g. EUR)
- items – Invoice items
- status – State of the invoice. For allowed values see
InvoiceStatus
, default: “created”. - change_address – Address propagation. For allowed values see
InvoiceChangeAddress
, default: “invoice”. - salutation – Salutation text
- footer – Footer text
- discount – Discount in percent (between 0.0 and 100.0)
- cash_discount – Cash discount in percent (between 0.0 and 100.0)
- cash_discount_days – How many days is the cash discount valid (ex. 4)
- project_id – Id of the project the invoice belongs to
Returns: the created invoice
Note
Note that if you create an invoice with a project, that project must also belong to the customer the invoice was created for.
-
get
(id: int)¶ Retrieve a single invoice.
Parameters: id – Invoice id Returns: Single invoice object
-
getlist
(status: moco_wrapper.models.invoice.InvoiceStatus = None, date_from: datetime.date = None, date_to: datetime.date = None, tags: list = None, identifier: str = None, term: str = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieve a list of invoices.
Parameters: - status – State of the invoice. For allowed values see
InvoiceStatus
- date_from – Starting date
- date_to – End date
- tags – List of tags
- identifier – Identifier string (e.g. R1903-003)
- term – Wildcard search term
- sort_by – Field to sort results by
- sort_order – asc or desc (default asc)
- page – Page number (default 1)
Returns: List of invoice objects
- status – State of the invoice. For allowed values see
-
locked
(status: moco_wrapper.models.invoice.InvoiceStatus = None, date_from: datetime.date = None, date_to: datetime.date = None, identifier: str = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieve a list of locked invoices.
Parameters: - status – State of the invoice. For allowed values see
InvoiceStatus
. - date_from – Start date
- date_to – End date
- identifier – Identifier string (ex. R1903-003)
- sort_by – Field to sort results by
- sort_order – asc or desc (default asc)
- page – Page number (default 1)
Returns: List of invoice objects
- status – State of the invoice. For allowed values see
-
pdf
(id: int)¶ Retrieve the invoice document as pdf.
Parameters: id – Invoice id Returns: Invoice pdf
-
timesheet
(id: int)¶ Retrieve the invoice timesheet document as pdf.
Invoices that have timesheets cannot be created with the api and must be created manully by billing unbilled tasks.
Parameters: id – Invoice id Returns: Invoice timesheet as pdf
-
update_status
(id: int, status: moco_wrapper.models.invoice.InvoiceStatus)¶ Updates the state of an invoices.
Parameters: - id – Invoice id
- status – New state of the invoice. For allowed values see
InvoiceStatus
.
Returns: Empty response on success
-
-
class
moco_wrapper.models.invoice.
InvoiceStatus
¶ Enumeration for allowed values that can be supplied for the
status
argument ofInvoice.getlist()
,Invoice.update_status()
andInvoice.create()
.Example usage:
from moco_wrapper.models.invoice import InvoiceStatus from moco_wrapper import Moco m = Moco() new_invoice = m.Invoice.create( .. status = InvoiceStatus.DRAFT )
-
CREATED
= 'created'¶
-
DRAFT
= 'draft'¶
-
IGNORED
= 'ignored'¶ Warning
Do not use this status for creating invoices, only updating and filtering
-
OVERDUE
= 'overdue'¶
-
PAID
= 'paid'¶
-
PARTIALLY_PAID
= 'partially_paid'¶
-
SENT
= 'sent'¶
-
-
class
moco_wrapper.models.invoice.
InvoiceChangeAddress
¶ Enumeration for allowed values that can be supplied for
change_address
argument ofInvoice.create()
.from moco_wrapper.models.invoice import InvoiceChangeAddress from moco_wrapper import Moco m = Moco() new_invoice = m.Invoice.create( .. change_address = InvoiceChangeAddress.PROJECT )
-
CUSTOMER
= 'customer'¶
-
INVOICE
= 'invoice'¶
-
PROJECT
= 'project'¶
-