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
| Field | Required | Notes |
|---|---|---|
id | (assigned) | Numeric BIGINT |
name | yes | |
code | yes | Natural key — upsert matches on this |
organization_type | yes | Numeric: 1=company, 2=division, 3=department, etc. |
parent_id | UUID of parent organization (for hierarchies) | |
active / active_from / active_to | ||
default_currency | 3-letter ISO code | |
custom_field_1..15 | Fifteen user-defined slots |
OrganizationIdentifier fields
| Field | Required |
|---|---|
identifier_label | yes |
identifier_value | yes |
identifier_type | yes — common values: VAT, DUNS, EIN, LEI |
OrganizationAddress fields
| Field | Required |
|---|---|
street | yes |
city | yes |
country_code | yes |
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 = 1
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.