Auto-generate invoice, quote and customer codes in SuiteCRM using templates with date, sequence and field placeholders, plus yearly or monthly resets.
Release Notes
Version 2.0.0 — 2026-05-18
Overview
Version 2.0.0 introduces a Format Template Engine that replaces the fixed Prefix + Number approach with a flexible, placeholder-based system supporting date-aware codes and automatic per-period counter resets. Existing configurations are fully backward compatible.
New Features
Format Template Engine
A new Format Template field accepts a template string with the following placeholders:
| Placeholder | Description | Example output |
|---|---|---|
{YYYY} |
4-digit year | 2026 |
{YY} |
2-digit year | 26 |
{MM} |
2-digit month | 05 |
{DD} |
2-digit day | 18 |
{SEQ:N} |
Sequential number, zero-padded to N digits | 00001 |
{FIELD:name} |
Value from a field on the target record | HN |
Example templates:
| Template | Sample output |
|---|---|
INV-{YYYY}-{SEQ:5} |
INV-2026-00001 |
PO-{YYYY}{MM}-{SEQ:4} |
PO-202605-0001 |
TKT-{YYYY}{MM}{DD}-{SEQ:3} |
TKT-20260518-001 |
{FIELD:branch_code}-{YYYY}-{SEQ:5} |
HN-2026-00001 |
Counter Reset Period
A new Reset Counter field controls when the sequential counter resets to 1:
| Option | Behaviour |
|---|---|
| Never | Global counter — never resets (equivalent to previous behaviour) |
| Yearly | Resets on the first record created in a new calendar year |
| Monthly | Resets on the first record created in a new calendar month |
| Daily | Resets on the first record created each day |
Improvements
Backward Compatibility
- Configurations using the legacy
Prefix+Initial Numberfields continue to work without any changes. No migration is required.
UI Enhancements
- New Format Template input in the Create/Edit form with a live JavaScript preview that shows an example output as you type.
- New Reset Counter dropdown in the Create/Edit form.
- List view now shows Format Template and Reset Counter columns.
Force Re-generate
- When using template mode, Force Re-generate All now resets the internal sequence counter before regenerating, ensuring codes start from 1 and are assigned in order.
Build System
build.phprewritten to use a functional pipeline (each builder accepts and returns$installdefs) following the same pattern as other MTS add-ons.- Manifest output now uses PHP short array syntax
[...]for readability. - ZIP creation uses a recursive iterator instead of
addGlob.
Database Changes
The following columns are added to mts_codegenerator during installation:
| Column | Type | Default | Purpose |
|---|---|---|---|
code_format_template |
varchar(255) | — | Template string |
reset_period |
varchar(100) | never |
Reset frequency |
last_seq_number |
int | 0 |
Current counter value |
last_reset_date |
date | — | Date of last counter reset |
Upgrade Notes
- Install the package via Admin → Module Loader as usual.
- Existing configuration records continue working in legacy mode — no action needed.
- To switch a configuration to template mode, edit the record, fill in the Format Template field, and set a Reset Counter period. Leave Prefix and Initial Number blank when using template mode.
- Use Force Re-generate All after switching mode if you want to backfill existing records with codes in the new format.
[Version 1.0.0]
- Support auto-generate code for any modules that have configured
- Support re-generate code for old records