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 laben 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, address: str = None, info: str = None, custom_properties: dict = None, labels: 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
  • fax (str) – Fax number of the company
  • phone (str) – Phone number of the company
  • email (str) – Email address of the company
  • address (str) – Company address
  • info (str) – Additional information about the company
  • custom_properties (dict) – Custom properties dictionary
  • labels (list) – Array of labels
  • user_id (int) – User Id of the responsible person
  • currency (str) – Currency the company uses (only customer)
  • identifier (str) – Identifier of the company (only mandatory when not automaticly assigned)
  • billing_tax (float) – Billing tax value (from 0 to 100)
  • default_invoice_due_days (int) – Payment target days for the company when creating invoices (only customer)
  • country_code (str) – ISO Alpha-2 Country Code like “DE” / “CH” / “AT” in upper case - default is account country
  • vat_identifier (str) – Vat identifier for eu companies
  • iban (str) – Iban number (only supplier)
  • 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)
Returns:

The created company

Note

When supplying a vat_identifier, make sure it is valid

get(company_id: int)

Get a single company.

Parameters:company_id (int) – Id of the company
Returns:Single company object
getlist(company_type: moco_wrapper.models.company.CompanyType = None, tags: list = None, identifier: 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
  • tags (list) – List of tags
  • identifier (str) – Company identifier
  • sort_by (str) – Field to sort by
  • sort_order (str) – asc or desc
  • page (int) – page number (default 1)
Returns:

list of companies

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, address: str = None, info: str = None, custom_properties: dict = None, labels: 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
  • name (str) – Name of the company
  • website (str) – Url of the companies website
  • fax (str) – Fax number of the company
  • phone (str) – Phone number of the company
  • email (str) – Email address of the company
  • address (str) – Company address
  • info (str) – Additional information about the company
  • custom_properties (dict) – Custom properties dictionary
  • labels (list) – Array of labels
  • user_id (int) – Id of the responsible person
  • currency (str) – Currency the company uses (only customer)
  • identifier (str) – Identifier of the company (only mandatory when not automatily 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
  • vat_identifier (str) – vat identifier for eu companies
  • iban (str) – iban number (only supplier)
  • 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

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'