Skip to content

Controlling accounting fields

Each field in the accounting form is an entry in the conf.AccountingFields table (see Configuring accounting). This page describes how you control whether a field is visible and editable, and how fields depend on each other.

Without further configuration, what is stored in conf.AccountingFields applies:

  • Visible: whether the field is shown.
  • Disabled: whether the field is locked.

Allowed values are "true" and "false", including the quotation marks. Instead of a fixed value you can also store a simple expression that the form evaluates in the browser, for example:

!this.disableVat

A field’s status can also be changed by the backend while the form is being edited, for example depending on the selected account. For this, each accounting line has status properties such as AccountVisibility. So that the form knows which field belongs to which property, enter the name of the property in the VisibilityTarget column of conf.AccountingFields, for example accountVisibility for the account field.

These values are possible:

ValueEffect
default (or empty)The configuration from Visible and Disabled applies.
activatedThe field is shown and editable.
deactivatedThe field is shown but locked.
hiddenThe field is invisible, but its space in the form remains.
removedThe field is removed; the following fields move up.
forceRequiredThe field is shown and must be filled in.
noValidationThe field is shown; all checks on the field are dropped.
replacedBy:NAMEThe field is replaced by a template defined in the frontend named NAME.

Example from a customer-specific validation plugin (derived from IrValidationManager):

protected virtual void LinePropertyChangedCostcenterId(ref UpdateIrCase updateIrCase,
ref UpdateIrCaseResponse updateIrCaseResp, IrItemLine itemLine)
{
itemLine.AccountVisibility = IsSpecialCostcenter(itemLine.CostcenterId)
? "activated"
: "hidden";
updateIrCaseResp.ForceAccountingFormReload = true;
}

The method runs when the cost center changes. Depending on the cost center, the account field is shown or hidden, and then the form is rebuilt.

Hiding the cost center for balance sheet accounts

Section titled “Hiding the cost center for balance sheet accounts”

A common request: if a balance sheet account is selected in the account field, the cost center field should disappear. This works without an additional form.

  1. Master data: whether an account is a balance sheet account is stored in Mstr.Accounts in the IsBalanceSheetAccount column. The master data import usually fills this column through its mapping configuration.

  2. Cost center field: for the cost center field, enter in the Visible column:

    !this.isBilanzkonto

    The form sets isBilanzkonto automatically as soon as a balance sheet account is selected.

  3. Account field (optional): for the account field, enter in the ColSpan column:

    getColumnSpanDependingOnIsBilanzkonto

    The account field then becomes twice as wide for a balance sheet account (20 instead of 10) and fills the space of the hidden cost center.

Which accounts and cost centers are available in the form can be restricted through master data tables:

TableEffect
Mstr.AccountCostCentersFor a selected account, only the assigned cost centers are available.
Mstr.AccountGroupsFor a group (for example “Kitchen”), only the assigned accounts are available.
Mstr.CostCenterAccountGroupsFor a group, only the assigned cost centers are available.

In the DropDownOptions column of conf.AccountingFields you set the width of the drop-down list for a selection field:

{
"minWidth": "15vw",
"width": "300",
"resizeEnabled": true
}

With resizeEnabled, users can drag the list larger themselves.