Skip to main content

OrganizationLoad

Organization units (legal entities, divisions, business units). Has two child types: identifiers (VAT number, DUNS, EIN) and addresses.

Organization
├── identifiers[]
└── addresses[]

Import

from lib.objects.organization import OrganizationLoad

Standard BaseLoad methods

See baseload.md.

Organization fields

FieldRequiredNotes
id(assigned)UUID string
nameyes
codeyesNatural key — upsert matches on this
organization_typeyesNumeric: 1 = Group, 2 = Company, 3 = Department. A Company may have a Group parent, a Department must have a Company parent
parent_idUUID of parent organization (for hierarchies)
active / active_from / active_to
default_currency3-letter ISO code
custom_field_1..15Fifteen user-defined slots

OrganizationIdentifier fields

FieldRequired
identifier_labelyes
identifier_valueyes
identifier_typeyes — common values: VAT, DUNS, EIN, LEI

OrganizationAddress fields

FieldRequired
streetyes
cityyes
country_codeyes
state / postal_code / name
custom_field_1..5

Example

from lib.objects.organization import OrganizationLoad

def run(context):
load = OrganizationLoad(context)

org = load.new()
org.name = 'Acme EMEA BV'
org.code = 'ACME-EMEA'
org.organization_type = 2 # 1 Group, 2 Company, 3 Department
org.default_currency = 'EUR'

vat = org.new_identifier()
vat.identifier_label = 'VAT Number'
vat.identifier_value = 'NL123456789B01'
vat.identifier_type = 'VAT'

addr = org.new_address()
addr.street = 'Herengracht 500'
addr.city = 'Amsterdam'
addr.country_code = 'NL'

load.save_all()
return {'created': 1}

When to save organizations vs suppliers

Organizations are referenced by suppliers via organization_code. Always save organizations before suppliers in the same connector run, otherwise the supplier write will fail referential integrity.