Company

class moco_wrapper.models.Company(moco)

Class for handling companies.

Companies come in three different flavours (see CompanyType), customers are companies you do stuff for and send invoices to. suppliers are companies that supply stuff to you as a customer. Finally organizations are companies that do not fit the label customer or supplier. For the most part you will interact with companies of type customer.

Example usage:

from moco_wrapper import Moco

m = Moco()
new_customer = m.Company.create(
    "my new customer",
    "customer"
)
create(name: str, company_type: moco_wrapper.models.company.CompanyType, website: str = None, fax: str = None, phone: str = None, email: str = None, billing_email_cc: str = None, address: str = None, info: str = None, custom_properties: dict = None, tags: list = None, user_id: int = None, currency: str = None, identifier: str = None, billing_tax: float = None, default_invoice_due_days: int = None, country_code: str = None, vat_identifier: str = None, iban: str = None, debit_number: int = None, credit_number: int = None, footer: str = None)

Create a company.

Parameters:
  • name (str) – Name of the company
  • company_type (CompanyType, str) – Either customer, supplier or organization
  • website (str) – Url of the companies website (default None)
  • fax (str) – Fax number of the company (default None)
  • phone (str) – Phone number of the company (default None)
  • email (str) – Email address of the company (default None)
  • billing_email_cc (str) – Email address to cc for billing emails (default None)
  • address (str) – Company address (default None)
  • info (str) – Additional information about the company (default None)
  • custom_properties (dict) – Custom properties dictionary (default None)
  • tags (list) – Array of tags (default None)
  • user_id (int) – User Id of the responsible person (default None)
  • currency (str) – Currency the company uses (only customer) (default None)
  • identifier (str) – Identifier of the company (only mandatory when not automatically assigned) (default None)
  • billing_tax (float) – Billing tax value (from 0 to 100) (default None)
  • default_invoice_due_days (int) – Payment target days for the company when creating invoices (only customer) (default None)
  • country_code (str) – ISO Alpha-2 Country Code like “DE” / “CH” / “AT” in upper case - default is account country (default None)
  • vat_identifier (str) – Vat identifier for eu companies (default None)
  • iban (str) – Iban number (only supplier) (default None)
  • debit_number (int) – Debit number (if bookkeeping is enabled) (only customer) (default None)
  • credit_number (int) – Credit number (if bookkeeping is enabled) (only supplier) (default None)
  • footer (str) – Some html (appears at the end of invoices) (default None)
Returns:

The created company

Return type:

moco_wrapper.util.response.ObjectResponse

Note

When supplying a vat_identifier, make sure it is valid

delete(company_id: int)

Deletes a company

Parameters:company_id – Id of the company to delete
Type:company_id: int
Returns:Empty response on success
Return type:moco_wrapper.util.response.EmptyResponse
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(company_id: int)

Get a single company.

Parameters:company_id (int) – Id of the company
Returns:Single company object
Return type:moco_wrapper.util.response.ObjectResponse
getlist(company_type: moco_wrapper.models.company.CompanyType = None, tags: list = None, identifier: str = None, term: str = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Get a list of company objects.

Parameters:
  • company_type (CompanyType, str) – Type of company to filter for (default None)
  • term – Term to search for (default None)
  • tags (list) – List of tags (default None)
  • identifier (str) – Company identifier (default None)
  • sort_by (str) – Field to sort by (default None)
  • sort_order (str) – asc or desc (default "asc")
  • page (int) – page number (default 1)
Returns:

List of companies

Return type:

moco_wrapper.util.response.PagedListResponse

update(company_id: int, company_type: moco_wrapper.models.company.CompanyType = None, name: str = None, website: str = None, fax: str = None, phone: str = None, email: str = None, billing_email_cc: str = None, address: str = None, info: str = None, custom_properties: dict = None, tags: list = None, user_id: int = None, currency: str = None, identifier: str = None, billing_tax: float = None, default_invoice_due_days: int = None, country_code: str = None, vat_identifier: str = None, iban: str = None, debit_number: int = None, credit_number: int = None, footer: str = None)

Update a company.

Parameters:
  • company_id (int) – Id of the company
  • company_type (CompanyType, str) – Type of the company to modify (default None)
  • name (str) – Name of the company (default None)
  • website (str) – Url of the companies website (default None)
  • fax (str) – Fax number of the company (default None)
  • phone (str) – Phone number of the company (default None)
  • email (str) – Email address of the company (default None)
  • billing_email_cc (str) – Email address to cc in billing emails (default None)
  • address (str) – Company address (default None)
  • info (str) – Additional information about the company (default None)
  • custom_properties (dict) – Custom properties dictionary (default None)
  • tags (list) – Array of tags (default None)
  • user_id (int) – Id of the responsible person (default None)
  • currency (str) – Currency the company uses (only customer) (default None)
  • identifier (str) – Identifier of the company (only mandatory when not automatically assigned) (only customer) (default None)
  • billing_tax (float) – Billing tax value (only customer) (default None)
  • default_invoice_due_days (int) – payment target days for the company when creating invoices (only customer) (default None)
  • country_code (str) – ISO Alpha-2 Country Code like “DE” / “CH” / “AT” in upper case - default is account country (default None)
  • vat_identifier (str) – vat identifier for eu companies (default None)
  • iban (str) – iban number (only supplier) (default None)
  • debit_number (int) – Debit number (if bookkeeping is enabled) (only customer) (default None)
  • credit_number (int) – Credit number (if bookkeeping is enabled) (ony supplier) (default None)
Returns:

The updated company

Return type:

moco_wrapper.util.response.ObjectResponse

class moco_wrapper.models.company.CompanyType

Enumeration of the type of companies that exist. Can be used to supply the company_type argument of Company.create(), Company.update() and Company.getlist()

Example Usage:

from moco_wrapper import Moco
from moco_wrapper.models.company import CompanyType

m = Moco()
new_supplier = m.Company.create(
    ..
    company_type = CompanyType.ORGANIZATION
)
CUSTOMER = 'customer'
ORGANIZATION = 'organization'
SUPPLIER = 'supplier'