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 (int) – Id of the customer/company
- recipient_address (str) – Entry text for the customer (e.g. “My Customer\nMainStreet 5\nExample Town”)
- created_date (datetime.date, str) – Creation date of the invoice
- due_date (datetime.date, str) – Date the invoice is due
- service_period_from (datetime.date, str) – Service period start date
- service_period_to (datetime.date, str) – Service period end date
- title (str) – Title of the invoice
- tax (float) – Tax percent (between 0.0 and 100.0)
- currency (str) – Currency code (e.g. EUR)
- items (list) – Invoice items
- status (
InvoiceStatus
, str) – State of the invoice (default: “created”) - change_address (
InvoiceChangeAddress
, str) – Address propagation (default: “invoice”) - salutation (str) – Salutation text
- footer (str) – Footer text
- discount (float) – Discount in percent (between 0.0 and 100.0)
- cash_discount (float) – Cash discount in percent (between 0.0 and 100.0)
- cash_discount_days (float) – How many days is the cash discount valid (ex. 4)
- project_id (int) – 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
(invoice_id: int)¶ Retrieve a single invoice.
Parameters: invoice_id (int) – 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 (
InvoiceStatus
, str) – State of the invoice - date_from (datetime.date, str) – Starting date
- date_to (datetime.date, str) – End date
- tags (list) – List of tags
- identifier (str) – Identifier string (e.g. R1903-003)
- term (str) – Wildcard search term
- sort_by (str) – Field to sort results by
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of invoice objects
- status (
-
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 (
InvoiceStatus
, str) – State of the invoice - date_from (datetime.date, str) – Start date
- date_to (datetime.date, str) – End date
- identifier (str) – Identifier string (ex. R1903-003)
- sort_by (str) – Field to sort results by
- sort_order (str) – asc or desc (default asc)
- page (int) – Page number (default 1)
Returns: List of invoice objects
- status (
-
pdf
(invoice_id: int)¶ Retrieve the invoice document as pdf.
Parameters: invoice_id (int) – Invoice id Returns: Invoice pdf
-
timesheet
(invoice_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: invoice_id (int) – Invoice id Returns: Invoice timesheet as pdf
-
update_status
(invoice_id: int, status: moco_wrapper.models.invoice.InvoiceStatus)¶ Updates the state of an invoices.
Parameters: - invoice_id (int) – Invoice id
- status (
InvoiceStatus
, str) – New state of the invoice
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'¶
-