Mosce ERP · Help Center
Accounting

Journal entry templates

Create prebuilt structures with accounts and formulas to generate repetitive journal entries without rewriting them each time.

A journal entry template is a prebuilt structure with accounts and formulas that you create once and apply every time you need to repeat the same pattern. The formulas use variables (for example {{monto}}) that the system replaces on application, and the evaluator is a tightly-scoped math parser - it does not run eval().

Reading time: ~6 min

When to use this

  • You pass the same journal entry every month (rent, utilities, prorations).
  • You need automatic calculation mechanics (ITBIS at 18%, withholdings, percentage prorations).
  • You want to standardize how your team records certain events to avoid account errors.
  • Your accountant defined a table of model journal entries that you want to digitize.

Before you start

  • The Accounting module is active and your role includes the accounting:journal-entry-template permission.
  • You have the Chart of accounts loaded with the accounts you will reference.
  • You know which variables the template will take and which formulas to apply to each line.

How the model works

A template (JournalEntryTemplate) has a header and a collection of lines (JournalEntryTemplateLine). Each line points to an account and declares one of two formulas:

  • debitFormula: math expression that produces the debit.
  • creditFormula: math expression that produces the credit.

Only one of the two is filled in per line (XOR). The formulas can include:

  • Numeric constants (1500, 0.18).
  • Variables between double braces: {{monto}}, {{base}}, {{tasa}}.
  • Arithmetic operators: +, -, *, /, parentheses.

Examples:

  • {{monto}} - uses the variable directly.
  • {{monto}} * 0.18 - calculates ITBIS at 18%.
  • {{base}} * {{tasa}} / 100 - configurable percentage.

Step by step - create a template

  1. Go to Accounting → Templates and press New template.
  2. In the header complete:
    • Mandatory name (max. 150 characters). It appears in the selector when applying.
    • Optional description.
    • Active - deactivate if you want to hide it without losing the definition.
  3. Add the lines with Add line (minimum 2, with at least one debit and one credit):
    • Account from the Chart of accounts selector.
    • Debit formula or Credit formula (never both).
    • Optional description.
    • Order - use the Up / Down arrows to sort.
  4. Mosce ERP validates that there is at least one debit line and one credit line before allowing you to save. The balance validation happens when applying the template, not when defining it, because it is the variables that close the sums.
  5. Save. The template becomes available in the list and will appear as an option when creating new journal entries.

Apply a template

  1. From the template list, open the row and press Apply template. You can also invoke it from a new journal entry form.
  2. Step 1 - Variables: enter a numeric value for each {{variable}} detected in the formulas. If the template has no variables, you go directly to the next step.
  3. Step 2 - Preview: press Calculate preview. The system evaluates each formula, shows you the account, debit, credit, and description of each line, and a Balanced / unbalanced entry indicator with the totals.
  4. If the balance is correct, complete the final journal entry data:
    • Journal entry date.
    • Fiscal period.
    • Optional description and reference.
  5. You have two routes:
    • Confirm - creates the journal entry in Draft and leaves it ready to post.
    • Open in editor - takes you to the journal entry form with the lines preloaded so you can adjust manually before saving.

Edit and deactivate

  • Edit: open the template and modify lines, formulas, or accounts. Journal entries already created from it are not affected (there is no live relationship between a template and a posted journal entry).
  • Deactivate: press Delete template. It is marked as inactive (isActive = false) and stops appearing in the selectors. The definition is preserved.

Expected result

  • Reusable templates that reduce account errors and speed up monthly closings.
  • Resulting journal entries with source = TEMPLATE, traceable like any other manual journal entry.
  • The formulas are calculated safely - the parser only accepts basic arithmetic and declared variables.

Common errors

ErrorCauseSolution
TEMPLATE_FORMULA_INVALIDFormula with incorrect syntax or a reference to a variable not providedReview double braces and operators; correct it in the template edit
"The journal entry must have at least 2 lines"You deleted lines until only one was leftAdd the counterpart line
"There must be at least one debit line and one credit line"You defined only debitFormula or only creditFormulaAdd a line with the complementary formula
Preview marks unbalancedThe formulas do not tie out with the entered valuesAdjust the formula or the variable value
I do not see the template when applying from a journal entryIt is marked as inactiveReactivate it from the edit view