Organization (ORG)

The org submodule of com owns the legal-entity and internal-organization reference data: the finance companies that own inventory and balance the books, and the departments that issue purchase, sales, and production orders. It exposes a small lookup API and a static utility that other modules use to assert that two records belong to the same finance company. It depends on sys.loc for country/currency, on com.fin for default terms, on com.log for the partner number series, and is referenced by com.par whenever customers and suppliers are scoped to a company.

Concepts

Finance Company

The legal entity that owns inventory and to which all costs and revenues from purchase, sales, or production are assigned. Inventory is linked directly to the finance company; orders and production lines are linked to it indirectly through their department.

Department

An internal organizational unit that belongs to a finance company. Departments issue purchase and sales orders; multiple departments can share the same company.

Same-company check

A pre-validation rule applied wherever two records (a department and a partner, two departments) participate in the same business operation: they must (or in some cases, must not) belong to the same finance company.

Entities

ORG entities

Finance Company (Company)

A legal entity that owns inventory and is the bearer of costs and revenues.

FieldDescription

code

Business key (up to 4 characters).

currencyInt

Internal/reporting currency (final field — set at creation, never changed).

name1 / name2

Primary and optional secondary registered name.

street, area, zipcode, city, state, country

Registered address.

website

Optional website URL.

telephone

Optional phone number.

_email

Optional email address.

chamberOfCommerce

Optional Chamber-of-Commerce registration.

vatNumber

Optional VAT registration.

termsOfPayment

Optional default terms of payment used as a fallback for new partner records.

termsOfDelivery

Optional default terms of delivery.

termsOfInvoice

Optional default terms of invoice.

partnerNumberSeries

The number series allocated for partner codes that belong to this company.

Department (Department)

An internal organizational unit within a finance company.

FieldDescription

code

Business key (up to 6 characters).

description

Human-readable name.

company

The finance company the department belongs to.

numberSeries

Optional number series used when this department creates documents.

Functionality

Lookups

COM_ORG_QueryApi exposes thin lookups: getAllCompanies, getAllFinancialCompanies (currently identical), findCompanyByCode, and findDepartmentByCode. Other modules use these to resolve a code from a configuration or a request payload to the live entity.

Same-company assertions

COM_ORG_Util is a static helper used wherever a business operation requires two records to share (or not share) a finance company:

HelperEffect

assertDepartmentAndSupplierHaveSameCompany

Fails when the department and supplier belong to different companies.

assertDepartmentAndCustomerHaveSameCompany

Fails when the department and customer belong to different companies.

assertDepartmentsBelongToSameCompany

Fails when two departments belong to different companies.

assertDepartmentsHaveSameCompany

Same as above, with a request trace for diagnostics.

assertDepartmentsBelongToDifferentCompanies

Fails when two departments belong to the same company (used for inter-company transfers).

Each helper raises a business exception that names the offending records.

Public API

COM_ORG_QueryApi

Read-side facade.

MethodDescription

getAllCompanies()

Every finance company.

getAllFinancialCompanies()

Currently the same as getAllCompanies — reserved for a future split.

findCompanyByCode(Code4)

Company by code, or null.

findDepartmentByCode(Code6)

Department by code, or null.

COM_ORG_CommandApi

This submodule does not provide a command API class. Companies and departments are maintained through their default CRUD pages.

COM_ORG_Util

Static utility (see Same-company assertions above).

ViewModel actions

The submodule defines view models for Company and Department but does not declare any custom UI actions.